From 4d49d142aa1eb3cd394001fe3583537428922171 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 6 Jul 2020 12:26:09 +0200 Subject: [PATCH] Simplify interface settings with hide/show tools --- rtdata/languages/default | 3 ++ rtengine/procevents.h | 1 + rtengine/procparams.cc | 4 ++ rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 3 +- rtgui/controlspotpanel.cc | 102 +++++++++++++++++++++++++++++++++++++- rtgui/controlspotpanel.h | 7 +++ rtgui/locallab.cc | 26 ++++++++++ rtgui/paramsedited.cc | 7 +++ rtgui/paramsedited.h | 1 + 10 files changed, 153 insertions(+), 2 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 56c5edd2b..6105f36da 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1192,6 +1192,7 @@ HISTORY_MSG_950;Local - Mask Common GF strength HISTORY_MSG_951;Local - Mask Common GF angle HISTORY_MSG_952;Local - Mask Common soft radius HISTORY_MSG_953;Local - Mask Common blend chroma +HISTORY_MSG_954;Local - Show-hide tools HISTORY_MSG_BLSHAPE;Blur by level HISTORY_MSG_BLURCWAV;Blur chroma HISTORY_MSG_BLURWAV;Blur luminance @@ -2684,6 +2685,8 @@ TP_LOCALLAB_PDE;ΔØ Laplacian PDE - Dynamic Range compression + Standard TP_LOCALLAB_PDEFRA;PDE IPOL - Contrast attenuator ƒ TP_LOCALLAB_PDEFRAME_TOOLTIP;PDE IPOL - personal algorithm adapted from IPOL to Rawtherapee: lead to very different results and needs differents settings that Standard (negative black, gamma < 1,...)\nMay be usefull for low exposure or high dynamic range.\n TP_LOCALLAB_PREVIEW;Preview ΔE +TP_LOCALLAB_PREVHIDE;Hide all tools +TP_LOCALLAB_PREVSHOW;Show all tools TP_LOCALLAB_PROXI;ΔE decay TP_LOCALLAB_QUALCURV_METHOD;Curves type TP_LOCALLAB_QUAL_METHOD;Global quality diff --git a/rtengine/procevents.h b/rtengine/procevents.h index afc6036f2..a9fb56172 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -976,6 +976,7 @@ enum ProcEventCode { Evlocallabang_mask = 950, Evlocallabsoftradiusmask = 951, Evlocallabblendmaskab = 952, + EvLocallabSpotprevMethod = 953, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index d177e44a2..99731c469 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2615,6 +2615,7 @@ LocallabParams::LocallabSpot::LocallabSpot() : // Control spot settings name(""), isvisible(true), + prevMethod("hide"), shape("ELI"), spotMethod("norm"), wavMethod("D4"), @@ -3844,6 +3845,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const // Control spot settings name == other.name && isvisible == other.isvisible + && prevMethod == other.prevMethod && shape == other.shape && spotMethod == other.spotMethod && wavMethod == other.wavMethod @@ -5364,6 +5366,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo // Control spot settings saveToKeyfile(!pedited || spot_edited->name, "Locallab", "Name_" + index_str, spot.name, keyFile); saveToKeyfile(!pedited || spot_edited->isvisible, "Locallab", "Isvisible_" + index_str, spot.isvisible, keyFile); + saveToKeyfile(!pedited || spot_edited->prevMethod, "Locallab", "PrevMethod_" + index_str, spot.prevMethod, keyFile); saveToKeyfile(!pedited || spot_edited->shape, "Locallab", "Shape_" + index_str, spot.shape, keyFile); saveToKeyfile(!pedited || spot_edited->spotMethod, "Locallab", "SpotMethod_" + index_str, spot.spotMethod, keyFile); saveToKeyfile(!pedited || spot_edited->wavMethod, "Locallab", "WavMethod_" + index_str, spot.wavMethod, keyFile); @@ -7029,6 +7032,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) // Control spot settings assignFromKeyfile(keyFile, "Locallab", "Isvisible_" + index_str, pedited, spot.isvisible, spotEdited.isvisible); + assignFromKeyfile(keyFile, "Locallab", "PrevMethod_" + index_str, pedited, spot.prevMethod, spotEdited.prevMethod); assignFromKeyfile(keyFile, "Locallab", "Shape_" + index_str, pedited, spot.shape, spotEdited.shape); assignFromKeyfile(keyFile, "Locallab", "SpotMethod_" + index_str, pedited, spot.spotMethod, spotEdited.spotMethod); assignFromKeyfile(keyFile, "Locallab", "wavMethod_" + index_str, pedited, spot.wavMethod, spotEdited.wavMethod); diff --git a/rtengine/procparams.h b/rtengine/procparams.h index a82e87dd1..f6ec6cb19 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -976,6 +976,7 @@ struct LocallabParams { // Control spot settings Glib::ustring name; bool isvisible; + Glib::ustring prevMethod; // show, hide Glib::ustring shape; // ELI, RECT Glib::ustring spotMethod; // norm, exc Glib::ustring wavMethod; // D2, D4, D6, D10, D14 diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 855f09572..cc71a78cf 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -979,7 +979,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabstr_mask LUMINANCECURVE, // Evlocallabang_mask LUMINANCECURVE, // Evlocallabsoftradiusmask - LUMINANCECURVE // Evlocallabblendmaskab + LUMINANCECURVE, // Evlocallabblendmaskab + LUMINANCECURVE // EvLocallabSpotprevMethod }; diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 5a1c76690..521026f19 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -48,6 +48,7 @@ ControlSpotPanel::ControlSpotPanel(): button_rename_(Gtk::manage(new Gtk::Button(M("TP_LOCALLAB_BUTTON_REN")))), button_visibility_(Gtk::manage(new Gtk::Button(M("TP_LOCALLAB_BUTTON_VIS")))), + prevMethod_(Gtk::manage(new MyComboBoxText())), shape_(Gtk::manage(new MyComboBoxText())), spotMethod_(Gtk::manage(new MyComboBoxText())), shapeMethod_(Gtk::manage(new MyComboBoxText())), @@ -92,6 +93,7 @@ ControlSpotPanel::ControlSpotPanel(): expMaskMerge_(Gtk::manage(new MyExpander(false, M("TP_LOCALLAB_MASFRAME")))), preview_(Gtk::manage(new Gtk::ToggleButton(M("TP_LOCALLAB_PREVIEW")))), + ctboxshape(Gtk::manage(new Gtk::HBox())), controlPanelListener(nullptr), lastObject_(-1), @@ -105,6 +107,18 @@ ControlSpotPanel::ControlSpotPanel(): { const bool showtooltip = options.showtooltip; + Gtk::HBox* const ctboxprevmethod = Gtk::manage(new Gtk::HBox()); + prevMethod_->append(M("TP_LOCALLAB_PREVHIDE")); + prevMethod_->append(M("TP_LOCALLAB_PREVSHOW")); + prevMethod_->set_active(0); + prevMethodconn_ = prevMethod_->signal_changed().connect( + sigc::mem_fun( + *this, &ControlSpotPanel::prevMethodChanged)); + + ctboxprevmethod->pack_start(*prevMethod_); + pack_start(*ctboxprevmethod); + + Gtk::HBox* const hbox1_ = Gtk::manage(new Gtk::HBox(true, 4)); buttonaddconn_ = button_add_->signal_clicked().connect( sigc::mem_fun(*this, &ControlSpotPanel::on_button_add)); @@ -176,7 +190,8 @@ ControlSpotPanel::ControlSpotPanel(): scrolledwindow_->set_min_content_height(150); pack_start(*scrolledwindow_); - Gtk::HBox* const ctboxshape = Gtk::manage(new Gtk::HBox()); +// Gtk::HBox* const ctboxshape = Gtk::manage(new Gtk::HBox()); + Gtk::Label* const labelshape = Gtk::manage(new Gtk::Label(M("TP_LOCALLAB_SHAPETYPE") + ":")); ctboxshape->pack_start(*labelshape, Gtk::PACK_SHRINK, 4); shape_->append(M("TP_LOCALLAB_ELI")); @@ -208,6 +223,7 @@ ControlSpotPanel::ControlSpotPanel(): ctboxspotmethod->pack_start(*spotMethod_); pack_start(*ctboxspotmethod); + excluFrame->set_label_align(0.025, 0.5); if (showtooltip) { @@ -782,6 +798,7 @@ void ControlSpotPanel::load_ControlSpot_param() const Gtk::TreeModel::Row row = *iter; // Load param in selected control spot + prevMethod_->set_active(row[spots_.prevMethod]); shape_->set_active(row[spots_.shape]); spotMethod_->set_active(row[spots_.spotMethod]); sensiexclu_->setValue((double)row[spots_.sensiexclu]); @@ -869,6 +886,55 @@ void ControlSpotPanel::shapeChanged() } } +void ControlSpotPanel::prevMethodChanged() +{ + // printf("prevMethodChanged\n"); + + // Get selected control spot + const auto s = treeview_->get_selection(); + + if (!s->count_selected_rows()) { + return; + } + + const auto iter = s->get_selected(); + Gtk::TreeModel::Row row = *iter; + + row[spots_.prevMethod] = prevMethod_->get_active_row_number(); + + // Update Control Spot GUI according to spotMethod_ combobox state (to be compliant with updateParamVisibility function) + if (multiImage && prevMethod_->get_active_text() == M("GENERAL_UNCHANGED")) { + expTransGrad_->show(); + expShapeDetect_->show(); + expSpecCases_->show(); + expMaskMerge_->show(); + circrad_->show(); + ctboxshape->show(); + } else if (prevMethod_->get_active_row_number() == 0) { // Normal case + expTransGrad_->hide(); + expShapeDetect_->hide(); + expSpecCases_->hide(); + expMaskMerge_->hide(); + circrad_->hide(); + ctboxshape->hide(); + + } else { // Excluding case + expTransGrad_->show(); + expShapeDetect_->show(); + expSpecCases_->show(); + expMaskMerge_->show(); + circrad_->show(); + ctboxshape->show(); + } + + // Raise event + if (listener) { + listener->panelChanged(EvLocallabSpotprevMethod, prevMethod_->get_active_text()); + } +} + + + void ControlSpotPanel::spotMethodChanged() { // printf("spotMethodChanged\n"); @@ -1113,6 +1179,32 @@ void ControlSpotPanel::updateParamVisibility() } else { // Excluding case excluFrame->show(); } + + + if (multiImage && prevMethod_->get_active_text() == M("GENERAL_UNCHANGED")) { + expTransGrad_->show(); + expShapeDetect_->show(); + expSpecCases_->show(); + expMaskMerge_->show(); + circrad_->show(); + ctboxshape->show(); + } else if (prevMethod_->get_active_row_number() == 0) { // Normal case + expTransGrad_->hide(); + expShapeDetect_->hide(); + expSpecCases_->hide(); + expMaskMerge_->hide(); + circrad_->hide(); + ctboxshape->hide(); + } else { // Excluding case + expTransGrad_->show(); + expShapeDetect_->show(); + expSpecCases_->show(); + expMaskMerge_->show(); + circrad_->show(); + ctboxshape->show(); + } + + } void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval) @@ -1341,6 +1433,9 @@ void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval) } } + + + void ControlSpotPanel::avoidChanged() { // printf("avoidChanged\n"); @@ -1532,6 +1627,7 @@ void ControlSpotPanel::disableParamlistener(bool cond) buttonduplicateconn_.block(cond); buttonrenameconn_.block(cond); buttonvisibilityconn_.block(cond); + prevMethodconn_.block(cond); shapeconn_.block(cond); spotMethodconn_.block(cond); sensiexclu_->block(cond); @@ -1573,6 +1669,7 @@ void ControlSpotPanel::setParamEditable(bool cond) { // printf("setParamEditable: %d\n", cond); + prevMethod_->set_sensitive(cond); shape_->set_sensitive(cond); spotMethod_->set_sensitive(cond); sensiexclu_->set_sensitive(cond); @@ -2229,6 +2326,7 @@ ControlSpotPanel::SpotRow* ControlSpotPanel::getSpot(const int index) if (i == index) { r->name = row[spots_.name]; r->isvisible = row[spots_.isvisible]; + r->prevMethod = row[spots_.prevMethod]; r->shape = row[spots_.shape]; r->spotMethod = row[spots_.spotMethod]; // r->mergeMethod = row[spots_.mergeMethod]; @@ -2361,6 +2459,7 @@ void ControlSpotPanel::addControlSpot(SpotRow* newSpot) row[spots_.name] = newSpot->name; row[spots_.isvisible] = newSpot->isvisible; row[spots_.curveid] = 0; // No associated curve + row[spots_.prevMethod] = newSpot->prevMethod; row[spots_.shape] = newSpot->shape; row[spots_.spotMethod] = newSpot->spotMethod; row[spots_.sensiexclu] = newSpot->sensiexclu; @@ -2473,6 +2572,7 @@ ControlSpotPanel::ControlSpots::ControlSpots() add(name); add(isvisible); add(curveid); + add(prevMethod); add(shape); add(spotMethod); add(sensiexclu); diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index f2bfa1fd0..01d939aec 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -50,6 +50,7 @@ public: struct SpotRow { Glib::ustring name; bool isvisible; + int prevMethod; // 0 = Normal, 1 = Excluding int shape; // 0 = Ellipse, 1 = Rectangle int spotMethod; // 0 = Normal, 1 = Excluding int sensiexclu; @@ -231,6 +232,7 @@ private: void controlspotChanged(); + void prevMethodChanged(); void shapeChanged(); void spotMethodChanged(); void shapeMethodChanged(); @@ -276,6 +278,7 @@ private: Gtk::TreeModelColumn name; Gtk::TreeModelColumn isvisible; Gtk::TreeModelColumn curveid; // Associated curve id + Gtk::TreeModelColumn prevMethod; // 0 = hide, 1 = show Gtk::TreeModelColumn shape; // 0 = Ellipse, 1 = Rectangle Gtk::TreeModelColumn spotMethod; // 0 = Normal, 1 = Excluding Gtk::TreeModelColumn sensiexclu; @@ -349,6 +352,8 @@ private: Gtk::Button* const button_visibility_; sigc::connection buttonvisibilityconn_; + MyComboBoxText* const prevMethod_; + sigc::connection prevMethodconn_; MyComboBoxText* const shape_; sigc::connection shapeconn_; MyComboBoxText* const spotMethod_; @@ -408,6 +413,8 @@ private: Gtk::ToggleButton* const preview_; sigc::connection previewConn_; + Gtk::HBox* const ctboxshape; + // Internal variables ControlPanelListener* controlPanelListener; int lastObject_; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index 80b92122a..274b5b43c 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -261,6 +261,12 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit r->shape = 1; } + if (pp->locallab.spots.at(i).prevMethod == "hide") { + r->prevMethod = 0; + } else { + r->prevMethod = 1; + } + if (pp->locallab.spots.at(i).spotMethod == "norm") { r->spotMethod = 0; } else { @@ -409,6 +415,13 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->shape = 1; } + if (newSpot->prevMethod == "hide") { + r->prevMethod = 0; + } else { + r->prevMethod = 1; + } + + if (newSpot->spotMethod == "norm") { r->spotMethod = 0; } else { @@ -686,6 +699,12 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited r->shape = 1; } + if (newSpot->prevMethod == "hide") { + r->prevMethod = 0; + } else { + r->prevMethod = 1; + } + if (newSpot->spotMethod == "norm") { r->spotMethod = 0; } else { @@ -845,6 +864,13 @@ void Locallab::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited pp->locallab.spots.at(pp->locallab.selspot).shape = "RECT"; } + if (r->prevMethod == 0) { + pp->locallab.spots.at(pp->locallab.selspot).prevMethod = "hide"; + } else { + pp->locallab.spots.at(pp->locallab.selspot).prevMethod = "show"; + } + + if (r->spotMethod == 0) { pp->locallab.spots.at(pp->locallab.selspot).spotMethod = "norm"; } else { diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 5e4b25042..bfcd97c46 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1024,6 +1024,7 @@ void ParamsEdited::initFrom(const std::vector& // Control spot settings locallab.spots.at(j).name = locallab.spots.at(j).name && pSpot.name == otherSpot.name; locallab.spots.at(j).isvisible = locallab.spots.at(j).isvisible && pSpot.isvisible == otherSpot.isvisible; + locallab.spots.at(j).prevMethod = locallab.spots.at(j).prevMethod && pSpot.prevMethod == otherSpot.prevMethod; locallab.spots.at(j).shape = locallab.spots.at(j).shape && pSpot.shape == otherSpot.shape; locallab.spots.at(j).spotMethod = locallab.spots.at(j).spotMethod && pSpot.spotMethod == otherSpot.spotMethod; locallab.spots.at(j).wavMethod = locallab.spots.at(j).wavMethod && pSpot.wavMethod == otherSpot.wavMethod; @@ -3062,6 +3063,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng toEdit.locallab.spots.at(i).isvisible = mods.locallab.spots.at(i).isvisible; } + if (locallab.spots.at(i).prevMethod) { + toEdit.locallab.spots.at(i).prevMethod = mods.locallab.spots.at(i).prevMethod; + } + if (locallab.spots.at(i).shape) { toEdit.locallab.spots.at(i).shape = mods.locallab.spots.at(i).shape; } @@ -6048,6 +6053,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) : // Control spot settings name(v), isvisible(v), + prevMethod(v), shape(v), spotMethod(v), wavMethod(v), @@ -6530,6 +6536,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v) { name = v; isvisible = v; + prevMethod = v; shape = v; spotMethod = v; wavMethod = v; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 327f3a370..a388db616 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -390,6 +390,7 @@ public: // Control spot settings bool name; bool isvisible; + bool prevMethod; bool shape; bool spotMethod; bool wavMethod;