Merge branch 'dev' into delayed_connection

This commit is contained in:
Flössie
2020-08-08 11:23:37 +02:00
20 changed files with 548 additions and 290 deletions

View File

@@ -9,6 +9,7 @@
#include "rtimage.h"
#include "options.h"
#include "../rtengine/color.h"
#include "eventmapper.h"
using namespace rtengine;
using namespace rtengine::procparams;
@@ -25,13 +26,26 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL")
nextsigma = 0.;
nextminT = 0.;
nextmaxT = 0.;
auto m = ProcEventMapper::getInstance();
EvReticomplex = m->newEvent(DEMOSAIC, "HISTORY_MSG_COMPLEXRETI");
const RetinexParams default_params;
// MAIN Expander ==================================================================
complexmethod = Gtk::manage (new MyComboBoxText ());
complexmethod->append(M("TP_WAVELET_COMPNORMAL"));
complexmethod->append(M("TP_WAVELET_COMPEXPERT"));
complexmethodconn = complexmethod->signal_changed().connect(sigc::mem_fun(*this, &Retinex::complexmethodChanged));
complexmethod->set_tooltip_text(M("TP_WAVELET_COMPLEX_TOOLTIP"));
Gtk::HBox* const complexHBox = Gtk::manage(new Gtk::HBox());
Gtk::Label* const complexLabel = Gtk::manage(new Gtk::Label(M("TP_WAVELET_COMPLEXLAB") + ":"));
complexHBox->pack_start(*complexLabel, Gtk::PACK_SHRINK, 4);
complexHBox->pack_start(*complexmethod);
pack_start(*complexHBox);
Gtk::Grid *retinexGrid = Gtk::manage ( new Gtk::Grid());
@@ -116,7 +130,8 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL")
// MAP (MASK) Frame ---------------------------------------------------------------
Gtk::Frame *maskFrame = Gtk::manage (new Gtk::Frame (M ("TP_RETINEX_LABEL_MASK")) );
// Gtk::Frame *maskFrame = Gtk::manage (new Gtk::Frame (M ("TP_RETINEX_LABEL_MASK")) );
maskFrame = Gtk::manage (new Gtk::Frame (M ("TP_RETINEX_LABEL_MASK")) );
setExpandAlignProperties (maskFrame, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
Gtk::Grid *maskGrid = Gtk::manage ( new Gtk::Grid());
@@ -384,7 +399,6 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL")
Gtk::Grid *tranGrid = Gtk::manage (new Gtk::Grid());
setExpandAlignProperties (tranGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START);
const RetinexParams default_params;
// Transmission map curve
transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M ("TP_RETINEX_TRANSMISSION"));
@@ -574,12 +588,14 @@ void Retinex::neutral_pressed ()
limd->resetValue (false);
highl->resetValue (false);
gam->resetValue (false);
skal->resetValue (false);
slope->resetValue (false);
highlights->resetValue (false);
h_tonalwidth->resetValue (false);
shadows->resetValue (false);
s_tonalwidth->resetValue (false);
radius->resetValue (false);
medianmap->set_active (false);
mapMethod->set_active (0);
viewMethod->set_active (0);
retinexMethod->set_active (2);
@@ -688,7 +704,53 @@ void Retinex::updateTrans ()
}
}
void Retinex::convertParamToNormal()
{
const RetinexParams def_params;
disableListener();
iter->setValue(def_params.iter);
viewMethod->set_active(0);
mapMethod->set_active(0);
cdshape->reset();
cdshapeH->reset();
lhshape->reset();
transmissionShape->reset();
medianmap->set_active(def_params.medianmap);
enableListener();
}
void Retinex::updateGUIToMode(int mode)
{
if(mode ==0) {
iterFrame->hide();
maskFrame->hide();
equalFrame->hide();
viewMethod->hide();
mapMethod->hide();
transmissionCurveEditorG->hide();
medianmap->hide();
} else {
iterFrame->show();
maskFrame->show();
equalFrame->show();
viewMethod->show();
transmissionCurveEditorG->show();
medianmap->show();
mapMethod->show();
if (iter->getIntValue() > 1) {
grad->set_sensitive (true);
scal->set_sensitive (true);
grads->set_sensitive (true);
} else {
grad->set_sensitive (false);
scal->set_sensitive (false);
grads->set_sensitive (false);
}
}
}
void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
{
@@ -698,6 +760,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
gammaretinexConn.block (true);
mapMethodConn.block (true);
viewMethodConn.block (true);
complexmethodconn.block (true);
if (pedited) {
@@ -721,6 +784,9 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
shadows->setEditedState (pedited->retinex.shadows ? Edited : UnEdited);
s_tonalwidth->setEditedState (pedited->retinex.stonalwidth ? Edited : UnEdited);
if (!pedited->retinex.complexmethod) {
complexmethod->set_active_text (M ("GENERAL_UNCHANGED"));
}
if (!pedited->retinex.retinexMethod) {
retinexMethod->set_active_text (M ("GENERAL_UNCHANGED"));
@@ -790,6 +856,13 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
medianmapConn.block (false);
lastmedianmap = pp->retinex.medianmap;
if (pp->retinex.complexmethod == "normal") {
complexmethod->set_active(0);
} else if (pp->retinex.complexmethod == "expert") {
complexmethod->set_active(1);
}
if (pp->retinex.retinexMethod == "low") {
retinexMethod->set_active (0);
} else if (pp->retinex.retinexMethod == "uni") {
@@ -852,6 +925,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
mapMethodChanged ();
viewMethodChanged ();
medianmapConn.block (true);
medianmapChanged ();
medianmapConn.block (false);
@@ -860,7 +934,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
cdshapeH->setCurve (pp->retinex.cdHcurve);
lhshape->setCurve (pp->retinex.lhcurve);
mapshape->setCurve (pp->retinex.mapcurve);
retinexMethodConn.block (false);
retinexColorSpaceConn.block (false);
gammaretinexConn.block (false);
@@ -869,8 +943,18 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited)
transmissionShape->setCurve (pp->retinex.transmissionCurve);
gaintransmissionShape->setCurve (pp->retinex.gaintransmissionCurve);
complexmethodconn.block (false);
enableListener ();
if (complexmethod->get_active_row_number() == 0) {
updateGUIToMode(0);
// convertParamToNormal();
} else {
updateGUIToMode(1);
}
}
@@ -907,6 +991,7 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
pp->retinex.stonalwidth = (int)s_tonalwidth->getValue ();
if (pedited) {
pedited->retinex.complexmethod = complexmethod->get_active_text() != M ("GENERAL_UNCHANGED");
pedited->retinex.retinexMethod = retinexMethod->get_active_text() != M ("GENERAL_UNCHANGED");
pedited->retinex.retinexcolorspace = retinexcolorspace->get_active_text() != M ("GENERAL_UNCHANGED");
pedited->retinex.gammaretinex = gammaretinex->get_active_text() != M ("GENERAL_UNCHANGED");
@@ -944,6 +1029,12 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
}
if (complexmethod->get_active_row_number() == 0) {
pp->retinex.complexmethod = "normal";
} else if (complexmethod->get_active_row_number() == 1) {
pp->retinex.complexmethod = "expert";
}
if (retinexMethod->get_active_row_number() == 0) {
pp->retinex.retinexMethod = "low";
} else if (retinexMethod->get_active_row_number() == 1) {
@@ -1002,6 +1093,27 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
}
void Retinex::complexmethodChanged()
{
if (!batchMode) {
if (complexmethod->get_active_row_number() == 0) {
updateGUIToMode(0);
convertParamToNormal();
} else {
updateGUIToMode(1);
}
}
if (listener) {
listener->panelChanged(EvReticomplex, complexmethod->get_active_text());
}
}
void Retinex::retinexMethodChanged()
{
@@ -1084,8 +1196,11 @@ void Retinex::viewMethodChanged()
limd->show();
transmissionCurveEditorG->show();
medianmap->show();
iterFrame->show();
if (complexmethod->get_active_row_number() == 0) {
iterFrame->hide();
} else {
iterFrame->show();
}
/*
iter->show();
scal->show();
@@ -1468,6 +1583,7 @@ void Retinex::setBatchMode (bool batchMode)
h_tonalwidth->showEditedCB ();
shadows->showEditedCB ();
s_tonalwidth->showEditedCB ();
// complexmethod->append(M("GENERAL_UNCHANGED"));
skal->showEditedCB ();
curveEditorGD->setBatchMode (batchMode);