diff --git a/rtengine/procevents.h b/rtengine/procevents.h index e3243938f..160441c4d 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -950,7 +950,7 @@ enum ProcEventCode { EvLocallabSpotcolorscope = 924, EvlocallabshowmasktypMethod = 925, Evlocallabshadmaskblsha = 926, - + EvLocenamask = 927, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index f72cbcb62..0aedc8d42 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3732,7 +3732,11 @@ LocallabParams::LocallabSpot::LocallabSpot() : sensilog(60), baselog(2.), strlog(0.0), - anglog(0.0) + anglog(0.0), + // mask + visimask(false), + expmask(false) + { } @@ -4202,7 +4206,11 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const && sensilog == other.sensilog && baselog == other.baselog && strlog == other.strlog - && anglog == other.anglog; + && anglog == other.anglog + // mask + && visimask == other.visimask + && expmask == other.expmask; + } bool LocallabParams::LocallabSpot::operator !=(const LocallabSpot& other) const @@ -5696,6 +5704,10 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || spot_edited->strlog, "Locallab", "Strlog_" + index_str, spot.strlog, keyFile); saveToKeyfile(!pedited || spot_edited->anglog, "Locallab", "Anglog_" + index_str, spot.anglog, keyFile); } + //mask + if ((!pedited || spot_edited->visimask) && spot.visimask) { + saveToKeyfile(!pedited || spot_edited->expmask, "Locallab", "Expmask_" + index_str, spot.expmask, keyFile); + } } } @@ -7409,6 +7421,12 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Baselog_" + index_str, pedited, spot.baselog, spotEdited.baselog); assignFromKeyfile(keyFile, "Locallab", "Strlog_" + index_str, pedited, spot.strlog, spotEdited.strlog); assignFromKeyfile(keyFile, "Locallab", "Anglog_" + index_str, pedited, spot.anglog, spotEdited.anglog); + // mask + spot.visimask = assignFromKeyfile(keyFile, "Locallab", "Expmask_" + index_str, pedited, spot.expmask, spotEdited.expmask); + + if (spot.visimask) { + spotEdited.visimask = true; + } // Append LocallabSpot and LocallabParamsEdited locallab.spots.push_back(spot); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c304c02ff..8fafa3a46 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -1421,6 +1421,9 @@ struct LocallabParams { double baselog; double strlog; double anglog; + // mask + bool visimask; + bool expmask; LocallabSpot(); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 773ec8b68..6ebcd74f1 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -953,8 +953,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { M_VOID, // EvlocallabcomplexityWithoutRefresh LUMINANCECURVE, // EvLocallabSpotcolorscope LUMINANCECURVE, //EvlocallabshowmasktypMethod - LUMINANCECURVE // Evlocallabshadmaskblsha - + LUMINANCECURVE, // Evlocallabshadmaskblsha + LUMINANCECURVE //EvLocenamask }; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index a4351c710..004031c72 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -162,6 +162,7 @@ Locallab::Locallab(): expcontrast(Gtk::manage(new LocallabContrast())), expcbdl(Gtk::manage(new LocallabCBDL())), explog(Gtk::manage(new LocallabLog())), + expmask(Gtk::manage(new LocallabMask())), // Other widgets resetshowButton(Gtk::manage(new Gtk::Button(M("TP_LOCALLAB_RESETSHOW")))) @@ -198,6 +199,7 @@ Locallab::Locallab(): addTool(toolpanel, expcontrast); addTool(toolpanel, expcbdl); addTool(toolpanel, explog); + addTool(toolpanel, expmask); panel->pack_start(*toolpanel, false, false); // Add separator diff --git a/rtgui/locallab.h b/rtgui/locallab.h index 8d68576f4..75523a5d3 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -115,6 +115,7 @@ private: LocallabContrast* const expcontrast; LocallabCBDL* const expcbdl; LocallabLog* const explog; + LocallabMask* const expmask; std::vector locallabTools; diff --git a/rtgui/locallabtools.h b/rtgui/locallabtools.h index 4e6b30f00..5da061b89 100644 --- a/rtgui/locallabtools.h +++ b/rtgui/locallabtools.h @@ -1196,4 +1196,53 @@ private: void updateLogGUI(); }; + +/* ==== LocallabMask ==== */ +class LocallabMask: + public Gtk::VBox, + public LocallabTool +{ +private: +/* + Gtk::ToggleButton* const autocompute; + Gtk::Frame* const logPFrame; + Adjuster* const blackEv; + Adjuster* const whiteEv; + Gtk::CheckButton* const fullimage; + Gtk::CheckButton* const Autogray; + Adjuster* const sourceGray; + Adjuster* const targetGray; + Adjuster* const detail; + Adjuster* const baselog; + Adjuster* const sensilog; + Adjuster* const strlog; + Adjuster* const anglog; + + sigc::connection autoconn, fullimageConn, AutograyConn; +*/ +public: + LocallabMask(); + void updateAdviceTooltips(const bool showTooltips) override; + + void disableListener() override; + void enableListener() override; + void read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr) override; + void write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr) override; + void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr) override; + void adjusterChanged(Adjuster* a, double newval) override; + +// void updateAutocompute(const float blackev, const float whiteev, const float sourceg, const float targetg); + +private: + void enabledChanged() override; + /* + void autocomputeToggled(); + void fullimageChanged(); + void AutograyChanged(); + + void updateLogGUI(); + */ +}; + + #endif diff --git a/rtgui/locallabtools2.cc b/rtgui/locallabtools2.cc index 816bfcd30..930145bc8 100644 --- a/rtgui/locallabtools2.cc +++ b/rtgui/locallabtools2.cc @@ -4723,3 +4723,128 @@ void LocallabLog::updateLogGUI() // targetGray->set_sensitive(true); } } + + +/* ==== LocallabMask ==== */ +LocallabMask::LocallabMask(): + LocallabTool(this, M("TP_LOCALLAB_MASK_TOOLNAME"), M("TP_LOCALLAB_MASK"), false, false) + +{ + // Parameter Mask encoding specific widgets +} + +void LocallabMask::updateAdviceTooltips(const bool showTooltips) +{ + if (showTooltips) { + exp->set_tooltip_text(M("TP_LOCALLAB_MASK_TOOLTIP")); + } else { + exp->set_tooltip_text(M("")); + } +} + +void LocallabMask::disableListener() +{ + LocallabTool::disableListener(); + +} + +void LocallabMask::enableListener() +{ + LocallabTool::enableListener(); + +} + +void LocallabMask::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) +{ + // Disable all listeners + disableListener(); + + // Update GUI to selected spot value + const int index = pp->locallab.selspot; + + if (index < (int)pp->locallab.spots.size()) { + const LocallabParams::LocallabSpot& spot = pp->locallab.spots.at(index); + + spotName = spot.name; // Update spot name according to selected spot + + exp->set_visible(spot.visimask); + exp->setEnabled(spot.expmask); + + } + + // Enable all listeners + enableListener(); + + // Update Log Encoding GUI according to autocompute button state +// updateLogGUI(); + + // Note: No need to manage pedited as batch mode is deactivated for Locallab +} + +void LocallabMask::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) +{ + const int index = pp->locallab.selspot; + + if (index < (int)pp->locallab.spots.size()) { + LocallabParams::LocallabSpot& spot = pp->locallab.spots.at(index); + + spot.expmask = exp->getEnabled(); + spot.visimask = exp->get_visible(); + + } + + // Note: No need to manage pedited as batch mode is deactivated for Locallab +} + +void LocallabMask::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited) +{ + const int index = defParams->locallab.selspot; + + if (index < (int)defParams->locallab.spots.size()) { + const LocallabParams::LocallabSpot& defSpot = defParams->locallab.spots.at(index); + + // Set default value for adjuster widgets + } + + // Note: No need to manage pedited as batch mode is deactivated for Locallab +} + +void LocallabMask::adjusterChanged(Adjuster* a, double newval) +{ + if (isLocActivated && exp->getEnabled()) { + } +} + + +void LocallabMask::enabledChanged() +{ + if (isLocActivated) { + if (listener) { + if (exp->getEnabled()) { + listener->panelChanged(EvLocenamask, + M("GENERAL_ENABLED") + " (" + escapeHtmlChars(spotName) + ")"); + } else { + listener->panelChanged(EvLocenamask, + M("GENERAL_DISABLED") + " (" + escapeHtmlChars(spotName) + ")"); + } + } + } +} + + +/* +void LocallabLog::updateLogGUI() +{ + if (autocompute->get_active()) { + blackEv->set_sensitive(false); + whiteEv->set_sensitive(false); + sourceGray->set_sensitive(false); + // targetGray->set_sensitive(true); + } else { + blackEv->set_sensitive(true); + whiteEv->set_sensitive(true); + sourceGray->set_sensitive(true); + // targetGray->set_sensitive(true); + } +} +*/ \ No newline at end of file diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index bbfb7cc4e..086d6f7a6 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1477,6 +1477,10 @@ void ParamsEdited::initFrom(const std::vector& locallab.spots.at(j).baselog = locallab.spots.at(j).baselog && pSpot.baselog == otherSpot.baselog; locallab.spots.at(j).strlog = locallab.spots.at(j).strlog && pSpot.strlog == otherSpot.strlog; locallab.spots.at(j).anglog = locallab.spots.at(j).anglog && pSpot.anglog == otherSpot.anglog; + //mask + locallab.spots.at(j).visimask = locallab.spots.at(j).visimask && pSpot.visimask == otherSpot.visimask; + locallab.spots.at(j).expmask = locallab.spots.at(j).expmask && pSpot.expmask == otherSpot.expmask; + } } @@ -4781,6 +4785,16 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng if (locallab.spots.at(i).anglog) { toEdit.locallab.spots.at(i).anglog = mods.locallab.spots.at(i).anglog; } + + // mask + if (locallab.spots.at(i).visimask) { + toEdit.locallab.spots.at(i).visimask = mods.locallab.spots.at(i).visimask; + } + + if (locallab.spots.at(i).explog) { + toEdit.locallab.spots.at(i).expmask = mods.locallab.spots.at(i).expmask; + } + } if (pcvignette.enabled) { @@ -6349,7 +6363,11 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : sensilog(v), baselog(v), strlog(v), - anglog(v) + anglog(v), + // mask + visimask(v), + expmask(v) + { } @@ -6810,6 +6828,10 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) baselog = v; strlog = v; anglog = v; + // mask + visimask = v; + expmask = v; + } bool CaptureSharpeningParamsEdited::isUnchanged() const diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 1bd2e045e..be0c0e347 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -835,6 +835,9 @@ public: bool baselog; bool strlog; bool anglog; + //mask + bool visimask; + bool expmask; LocallabSpotEdited(bool v);