Added tool mask

This commit is contained in:
Desmis 2020-06-21 09:49:53 +02:00
parent 680792807a
commit 0884203966
10 changed files with 229 additions and 6 deletions

View File

@ -950,7 +950,7 @@ enum ProcEventCode {
EvLocallabSpotcolorscope = 924,
EvlocallabshowmasktypMethod = 925,
Evlocallabshadmaskblsha = 926,
EvLocenamask = 927,
NUMOFEVENTS
};

View File

@ -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);

View File

@ -1421,6 +1421,9 @@ struct LocallabParams {
double baselog;
double strlog;
double anglog;
// mask
bool visimask;
bool expmask;
LocallabSpot();

View File

@ -953,8 +953,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = {
M_VOID, // EvlocallabcomplexityWithoutRefresh
LUMINANCECURVE, // EvLocallabSpotcolorscope
LUMINANCECURVE, //EvlocallabshowmasktypMethod
LUMINANCECURVE // Evlocallabshadmaskblsha
LUMINANCECURVE, // Evlocallabshadmaskblsha
LUMINANCECURVE //EvLocenamask
};

View File

@ -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

View File

@ -115,6 +115,7 @@ private:
LocallabContrast* const expcontrast;
LocallabCBDL* const expcbdl;
LocallabLog* const explog;
LocallabMask* const expmask;
std::vector<LocallabTool*> locallabTools;

View File

@ -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

View File

@ -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);
}
}
*/

View File

@ -1477,6 +1477,10 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
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

View File

@ -835,6 +835,9 @@ public:
bool baselog;
bool strlog;
bool anglog;
//mask
bool visimask;
bool expmask;
LocallabSpotEdited(bool v);