revamped and simplified dehaze -- now it's finally usable

This commit is contained in:
Alberto Griggio
2018-10-16 23:20:11 +02:00
parent 7c10f92ace
commit 4d0ddd56e5
8 changed files with 87 additions and 237 deletions

View File

@@ -32,27 +32,21 @@ Dehaze::Dehaze(): FoldableToolPanel(this, "dehaze", M("TP_DEHAZE_LABEL"), false,
EvDehazeStrength = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_STRENGTH");
EvDehazeShowDepthMap = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_SHOW_DEPTH_MAP");
EvDehazeDepth = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_DEPTH");
EvDehazeDetail = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_DETAIL");
strength = Gtk::manage(new Adjuster(M("TP_DEHAZE_STRENGTH"), 0., 100., 1., 50.));
strength->setAdjusterListener(this);
strength->show();
depth = Gtk::manage(new Adjuster(M("TP_DEHAZE_DEPTH"), -100., 100., 1., 0.));
depth = Gtk::manage(new Adjuster(M("TP_DEHAZE_DEPTH"), 0., 100., 1., 25.));
depth->setAdjusterListener(this);
depth->show();
detail = Gtk::manage(new Adjuster(M("TP_DEHAZE_DETAIL"), -100, 100, 1, 0));
detail->setAdjusterListener(this);
detail->show();
showDepthMap = Gtk::manage(new Gtk::CheckButton(M("TP_DEHAZE_SHOW_DEPTH_MAP")));
showDepthMap->signal_toggled().connect(sigc::mem_fun(*this, &Dehaze::showDepthMapChanged));
showDepthMap->show();
pack_start(*strength);
pack_start(*depth);
pack_start(*detail);
pack_start(*showDepthMap);
}
@@ -64,7 +58,6 @@ void Dehaze::read(const ProcParams *pp, const ParamsEdited *pedited)
if (pedited) {
strength->setEditedState(pedited->dehaze.strength ? Edited : UnEdited);
depth->setEditedState(pedited->dehaze.depth ? Edited : UnEdited);
detail->setEditedState(pedited->dehaze.detail ? Edited : UnEdited);
set_inconsistent(multiImage && !pedited->dehaze.enabled);
showDepthMap->set_inconsistent(!pedited->dehaze.showDepthMap);
}
@@ -72,7 +65,6 @@ void Dehaze::read(const ProcParams *pp, const ParamsEdited *pedited)
setEnabled(pp->dehaze.enabled);
strength->setValue(pp->dehaze.strength);
depth->setValue(pp->dehaze.depth);
detail->setValue(pp->dehaze.detail);
showDepthMap->set_active(pp->dehaze.showDepthMap);
enableListener();
@@ -83,14 +75,12 @@ void Dehaze::write(ProcParams *pp, ParamsEdited *pedited)
{
pp->dehaze.strength = strength->getValue();
pp->dehaze.depth = depth->getValue();
pp->dehaze.detail = detail->getValue();
pp->dehaze.enabled = getEnabled();
pp->dehaze.showDepthMap = showDepthMap->get_active();
if (pedited) {
pedited->dehaze.strength = strength->getEditedState();
pedited->dehaze.depth = depth->getEditedState();
pedited->dehaze.detail = detail->getEditedState();
pedited->dehaze.enabled = !get_inconsistent();
pedited->dehaze.showDepthMap = !showDepthMap->get_inconsistent();
}
@@ -100,16 +90,13 @@ void Dehaze::setDefaults(const ProcParams *defParams, const ParamsEdited *pedite
{
strength->setDefault(defParams->dehaze.strength);
depth->setDefault(defParams->dehaze.depth);
detail->setDefault(defParams->dehaze.detail);
if (pedited) {
strength->setDefaultEditedState(pedited->dehaze.strength ? Edited : UnEdited);
depth->setDefaultEditedState(pedited->dehaze.depth ? Edited : UnEdited);
detail->setDefaultEditedState(pedited->dehaze.detail ? Edited : UnEdited);
} else {
strength->setDefaultEditedState(Irrelevant);
depth->setDefaultEditedState(Irrelevant);
detail->setDefaultEditedState(Irrelevant);
}
}
@@ -121,8 +108,6 @@ void Dehaze::adjusterChanged(Adjuster* a, double newval)
listener->panelChanged(EvDehazeStrength, a->getTextValue());
} else if (a == depth) {
listener->panelChanged(EvDehazeDepth, a->getTextValue());
} else if (a == detail) {
listener->panelChanged(EvDehazeDetail, a->getTextValue());
}
}
}
@@ -156,7 +141,6 @@ void Dehaze::setBatchMode(bool batchMode)
strength->showEditedCB();
depth->showEditedCB();
detail->showEditedCB();
}

View File

@@ -28,13 +28,11 @@ class Dehaze: public ToolParamBlock, public AdjusterListener, public FoldableToo
private:
Adjuster *strength;
Adjuster *depth;
Adjuster *detail;
Gtk::CheckButton *showDepthMap;
rtengine::ProcEvent EvDehazeEnabled;
rtengine::ProcEvent EvDehazeStrength;
rtengine::ProcEvent EvDehazeDepth;
rtengine::ProcEvent EvDehazeDetail;
rtengine::ProcEvent EvDehazeShowDepthMap;
public:

View File

@@ -570,7 +570,6 @@ void ParamsEdited::set(bool v)
dehaze.strength = v;
dehaze.showDepthMap = v;
dehaze.depth = v;
dehaze.detail = v;
metadata.mode = v;
exif = v;
@@ -1128,7 +1127,6 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
dehaze.strength = dehaze.strength && p.dehaze.strength == other.dehaze.strength;
dehaze.showDepthMap = dehaze.showDepthMap && p.dehaze.showDepthMap == other.dehaze.showDepthMap;
dehaze.depth = dehaze.depth && p.dehaze.depth == other.dehaze.depth;
dehaze.detail = dehaze.detail && p.dehaze.detail == other.dehaze.detail;
metadata.mode = metadata.mode && p.metadata.mode == other.metadata.mode;
// How the hell can we handle that???
@@ -3135,10 +3133,6 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.dehaze.depth = mods.dehaze.depth;
}
if (dehaze.detail) {
toEdit.dehaze.detail = mods.dehaze.detail;
}
if (dehaze.showDepthMap) {
toEdit.dehaze.showDepthMap = mods.dehaze.showDepthMap;
}

View File

@@ -731,7 +731,6 @@ public:
bool strength;
bool showDepthMap;
bool depth;
bool detail;
};