Merge branch 'dev' into wavelenh

This commit is contained in:
Morgan Hardwood
2019-09-25 12:43:57 +02:00
18 changed files with 693 additions and 385 deletions

View File

@@ -36,6 +36,7 @@ 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");
EvDehazeLuminance = m->newEvent(HDR, "HISTORY_MSG_DEHAZE_LUMINANCE");
strength = Gtk::manage(new Adjuster(M("TP_DEHAZE_STRENGTH"), 0., 100., 1., 50.));
strength->setAdjusterListener(this);
@@ -45,12 +46,17 @@ Dehaze::Dehaze(): FoldableToolPanel(this, "dehaze", M("TP_DEHAZE_LABEL"), false,
depth->setAdjusterListener(this);
depth->show();
luminance = Gtk::manage(new Gtk::CheckButton(M("TP_DEHAZE_LUMINANCE")));
luminance->signal_toggled().connect(sigc::mem_fun(*this, &Dehaze::luminanceChanged));
luminance->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(*luminance);
pack_start(*showDepthMap);
}
@@ -64,12 +70,14 @@ void Dehaze::read(const ProcParams *pp, const ParamsEdited *pedited)
depth->setEditedState(pedited->dehaze.depth ? Edited : UnEdited);
set_inconsistent(multiImage && !pedited->dehaze.enabled);
showDepthMap->set_inconsistent(!pedited->dehaze.showDepthMap);
luminance->set_inconsistent(!pedited->dehaze.luminance);
}
setEnabled(pp->dehaze.enabled);
strength->setValue(pp->dehaze.strength);
depth->setValue(pp->dehaze.depth);
showDepthMap->set_active(pp->dehaze.showDepthMap);
luminance->set_active(pp->dehaze.luminance);
enableListener();
}
@@ -81,12 +89,14 @@ void Dehaze::write(ProcParams *pp, ParamsEdited *pedited)
pp->dehaze.depth = depth->getValue();
pp->dehaze.enabled = getEnabled();
pp->dehaze.showDepthMap = showDepthMap->get_active();
pp->dehaze.luminance = luminance->get_active();
if (pedited) {
pedited->dehaze.strength = strength->getEditedState();
pedited->dehaze.depth = depth->getEditedState();
pedited->dehaze.enabled = !get_inconsistent();
pedited->dehaze.showDepthMap = !showDepthMap->get_inconsistent();
pedited->dehaze.luminance = !luminance->get_inconsistent();
}
}
@@ -138,6 +148,12 @@ void Dehaze::showDepthMapChanged()
}
}
void Dehaze::luminanceChanged()
{
if (listener) {
listener->panelChanged(EvDehazeLuminance, luminance->get_active() ? M("GENERAL_ENABLED") : M("GENERAL_DISABLED"));
}
}
void Dehaze::setBatchMode(bool batchMode)
{

View File

@@ -28,12 +28,14 @@ class Dehaze: public ToolParamBlock, public AdjusterListener, public FoldableToo
private:
Adjuster *strength;
Adjuster *depth;
Gtk::CheckButton *showDepthMap;
Gtk::CheckButton *showDepthMap;
Gtk::CheckButton *luminance;
rtengine::ProcEvent EvDehazeEnabled;
rtengine::ProcEvent EvDehazeStrength;
rtengine::ProcEvent EvDehazeDepth;
rtengine::ProcEvent EvDehazeShowDepthMap;
rtengine::ProcEvent EvDehazeLuminance;
public:
@@ -47,6 +49,7 @@ public:
void adjusterChanged(Adjuster *a, double newval) override;
void enabledChanged() override;
void showDepthMapChanged();
void luminanceChanged();
void setAdjusterBehavior(bool strengthAdd);
};

View File

@@ -58,7 +58,7 @@ bool ExtProgAction::execute (const std::vector<Glib::ustring>& fileNames) const
}
for (const auto& fileName : fileNames) {
cmdLine += " \"" + fileName + "\"";
cmdLine += " " + Glib::shell_quote(fileName);
}
return ExtProgStore::spawnCommandAsync (cmdLine);
@@ -256,7 +256,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
#else
auto cmdLine = Glib::ustring("gimp \"") + fileName + Glib::ustring("\"");
auto cmdLine = Glib::ustring("gimp ") + Glib::shell_quote(fileName);
auto success = spawnCommandAsync (cmdLine);
#endif
@@ -291,7 +291,7 @@ bool ExtProgStore::openInGimp (const Glib::ustring& fileName)
#else
cmdLine = Glib::ustring("gimp-remote \"") + fileName + Glib::ustring("\"");
cmdLine = Glib::ustring("gimp-remote ") + Glib::shell_quote(fileName);
success = ExtProgStore::spawnCommandAsync (cmdLine);
#endif
@@ -312,7 +312,7 @@ bool ExtProgStore::openInPhotoshop (const Glib::ustring& fileName)
#else
const auto cmdLine = Glib::ustring("\"") + Glib::build_filename(options.psDir, "Photoshop.exe") + Glib::ustring("\" \"") + fileName + Glib::ustring("\"");
const auto cmdLine = Glib::ustring("\"") + Glib::build_filename(options.psDir, "Photoshop.exe") + "\" " + Glib::shell_quote(fileName);
#endif
@@ -334,7 +334,7 @@ bool ExtProgStore::openInCustomEditor (const Glib::ustring& fileName)
#else
const auto cmdLine = Glib::ustring("\"") + options.customEditorProg + Glib::ustring("\" \"") + fileName + Glib::ustring("\"");
const auto cmdLine = Glib::ustring("\"") + options.customEditorProg + "\" " + Glib::shell_quote(fileName);
return spawnCommandAsync (cmdLine);
#endif

View File

@@ -598,6 +598,7 @@ void ParamsEdited::set(bool v)
dehaze.strength = v;
dehaze.showDepthMap = v;
dehaze.depth = v;
dehaze.luminance = v;
metadata.mode = v;
filmNegative.enabled = v;
filmNegative.redRatio = v;
@@ -1180,6 +1181,7 @@ 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.luminance = dehaze.luminance && p.dehaze.luminance == other.dehaze.luminance;
metadata.mode = metadata.mode && p.metadata.mode == other.metadata.mode;
filmNegative.enabled = filmNegative.enabled && p.filmNegative.enabled == other.filmNegative.enabled;
filmNegative.redRatio = filmNegative.redRatio && p.filmNegative.redRatio == other.filmNegative.redRatio;
@@ -3290,6 +3292,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.dehaze.showDepthMap = mods.dehaze.showDepthMap;
}
if (dehaze.luminance) {
toEdit.dehaze.luminance = mods.dehaze.luminance;
}
if (metadata.mode) {
toEdit.metadata.mode = mods.metadata.mode;
}

View File

@@ -607,6 +607,7 @@ struct DehazeParamsEdited {
bool strength;
bool showDepthMap;
bool depth;
bool luminance;
};
struct RAWParamsEdited {

View File

@@ -18,22 +18,28 @@
*/
#include <cmath>
#include "eventmapper.h"
#include <iomanip>
#include "pdsharpening.h"
#include "eventmapper.h"
#include "options.h"
#include "../rtengine/procparams.h"
using namespace rtengine;
using namespace rtengine::procparams;
PdSharpening::PdSharpening() : FoldableToolPanel(this, "pdsharpening", M("TP_PDSHARPENING_LABEL"), false, true)
PdSharpening::PdSharpening() :
FoldableToolPanel(this, "capturesharpening", M("TP_PDSHARPENING_LABEL"), false, true),
lastAutoContrast(true),
lastAutoRadius(true)
{
auto m = ProcEventMapper::getInstance();
EvPdShrContrast = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_CONTRAST");
EvPdSharpenGamma = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_GAMMA");
EvPdShrDRadius = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_RADIUS");
EvPdShrDRadiusOffset = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_RADIUS_OFFSET");
EvPdShrDRadiusOffset = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_RADIUS_BOOST");
EvPdShrDIterations = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_ITERATIONS");
EvPdShrAutoContrast = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_AUTO_CONTRAST");
EvPdShrAutoRadius = m->newEvent(CAPTURESHARPEN, "HISTORY_MSG_PDSHARPEN_AUTO_RADIUS");
@@ -42,7 +48,7 @@ PdSharpening::PdSharpening() : FoldableToolPanel(this, "pdsharpening", M("TP_PDS
hb->show();
contrast = Gtk::manage(new Adjuster(M("TP_SHARPENING_CONTRAST"), 0, 200, 1, 10));
contrast->setAdjusterListener(this);
contrast->addAutoButton(M("TP_RAW_DUALDEMOSAICAUTOCONTRAST_TOOLTIP"));
contrast->addAutoButton();
contrast->setAutoValue(true);
pack_start(*contrast);
@@ -53,9 +59,9 @@ PdSharpening::PdSharpening() : FoldableToolPanel(this, "pdsharpening", M("TP_PDS
Gtk::VBox* rld = Gtk::manage(new Gtk::VBox());
gamma = Gtk::manage(new Adjuster(M("TP_SHARPENING_GAMMA"), 0.5, 6.0, 0.05, 1.00));
dradius = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS"), 0.4, 1.15, 0.01, 0.75));
dradius->addAutoButton(M("TP_PDSHARPENING_AUTORADIUS_TOOLTIP"));
dradius->addAutoButton();
dradius->setAutoValue(true);
dradiusOffset = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS_OFFSET"), 0.0, 0.5, 0.01, 0.0));
dradiusOffset = Gtk::manage(new Adjuster(M("TP_SHARPENING_RADIUS_BOOST"), -0.5, 0.5, 0.01, 0.0));
diter = Gtk::manage(new Adjuster(M("TP_SHARPENING_RLD_ITERATIONS"), 1, 100, 1, 20));
rld->pack_start(*gamma);
rld->pack_start(*dradius);