From bdb8a95b14176dfbbcb0df2ebdcf7b438430f0ae Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Mon, 4 May 2020 20:03:58 +0200 Subject: [PATCH] Use default complexity mode defined in preferences when adding tool --- rtdata/languages/default | 1 - rtgui/controlspotpanel.cc | 26 +++++--------------------- rtgui/locallab.cc | 24 +++++++----------------- rtgui/locallabtools.cc | 17 ++++++++++++++++- rtgui/options.cc | 2 +- rtgui/preferences.cc | 8 +------- 6 files changed, 30 insertions(+), 48 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index d9d7557f4..f3067f8e6 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1551,7 +1551,6 @@ PREFERENCES_CLUTSDIR;HaldCLUT directory PREFERENCES_CMMBPC;Black point compensation PREFERENCES_COMPLEXITYLOC;Complexity Local Adjustements PREFERENCES_COMPLEXITY_EXP;Expert -PREFERENCES_COMPLEXITY_CONF;Confirmed PREFERENCES_COMPLEXITY_NORM;Normal PREFERENCES_CROP;Crop Editing PREFERENCES_CROP_AUTO_FIT;Automatically zoom to fit the crop diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 0c1d81250..ea7ead200 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -94,7 +94,6 @@ ControlSpotPanel::ControlSpotPanel(): maskPrevActive(false) { const bool showtooltip = options.showtooltip; - const int complexsoft = options.complexity; Gtk::HBox* const hbox1_ = Gtk::manage(new Gtk::HBox(true, 4)); buttonaddconn_ = button_add_->signal_clicked().connect( @@ -230,10 +229,7 @@ ControlSpotPanel::ControlSpotPanel(): sigc::mem_fun( *this, &ControlSpotPanel::shapeMethodChanged)); ctboxshapemethod->pack_start(*shapeMethod_); - - if (complexsoft < 2) { - pack_start(*ctboxshapemethod); - } + pack_start(*ctboxshapemethod); pack_start(*locX_); locX_->setAdjusterListener(this); @@ -271,10 +267,7 @@ ControlSpotPanel::ControlSpotPanel(): sigc::mem_fun( *this, &ControlSpotPanel::qualityMethodChanged)); ctboxqualitymethod->pack_start(*qualityMethod_); - - if (complexsoft < 2) { - pack_start(*ctboxqualitymethod); - } + pack_start(*ctboxqualitymethod); Gtk::Frame* const transitFrame = Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_TRANSIT"))); transitFrame->set_label_align(0.025, 0.5); @@ -338,14 +331,8 @@ ControlSpotPanel::ControlSpotPanel(): colorde_->set_tooltip_text(M("TP_LOCALLAB_COLORDE_TOOLTIP")); } - if (complexsoft < 2) { - artifBox->pack_start(*struc_); - } - - if (complexsoft < 2) { - artifBox->pack_start(*thresh_); - } - + artifBox->pack_start(*struc_); + artifBox->pack_start(*thresh_); artifBox->pack_start(*iter_); artifBox->pack_start(*balan_); artifBox->pack_start(*balanh_); @@ -393,10 +380,7 @@ ControlSpotPanel::ControlSpotPanel(): savrest_->set_tooltip_text(M("TP_LOCALLAB_SAVREST_TOOLTIP")); } - if (complexsoft < 1) { - maskBox->pack_start(*laplac_); - } - + maskBox->pack_start(*laplac_); maskBox->pack_start(*deltae_); maskBox->pack_start(*scopemask_); // maskBox->pack_start(*shortc_); diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index e329bdbf9..ec30bb29a 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -20,14 +20,11 @@ * 2019 Pierre Cabrera */ #include "locallab.h" -#include "options.h" #include "../rtengine/procparams.h" using namespace rtengine; using namespace procparams; -extern Options options; - /* ==== LocallabToolList ==== */ LocallabToolList::LocallabToolList(): // Tool list GUI elements @@ -219,9 +216,6 @@ Locallab::Locallab(): void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited) { - // printf("Locallab read\n"); - const int complexsoft = options.complexity; - // Disable all listeners disableListener(); @@ -264,18 +258,14 @@ void Locallab::read(const rtengine::procparams::ProcParams* pp, const ParamsEdit r->sensiexclu = pp->locallab.spots.at(i).sensiexclu; r->structexclu = pp->locallab.spots.at(i).structexclu; - if (complexsoft < 2) { - if (pp->locallab.spots.at(i).shapeMethod == "IND") { - r->shapeMethod = 0; - } else if (pp->locallab.spots.at(i).shapeMethod == "SYM") { - r->shapeMethod = 1; - } else if (pp->locallab.spots.at(i).shapeMethod == "INDSL") { - r->shapeMethod = 2; - } else { - r->shapeMethod = 3; - } - } else { + if (pp->locallab.spots.at(i).shapeMethod == "IND") { r->shapeMethod = 0; + } else if (pp->locallab.spots.at(i).shapeMethod == "SYM") { + r->shapeMethod = 1; + } else if (pp->locallab.spots.at(i).shapeMethod == "INDSL") { + r->shapeMethod = 2; + } else { + r->shapeMethod = 3; } r->locX = pp->locallab.spots.at(i).loc.at(0); diff --git a/rtgui/locallabtools.cc b/rtgui/locallabtools.cc index 7ee4b2268..5f79d9713 100644 --- a/rtgui/locallabtools.cc +++ b/rtgui/locallabtools.cc @@ -190,7 +190,22 @@ void LocallabTool::addLocallabTool(bool raiseEvent) exp->set_visible(true); // Raise event if required - if (raiseEvent) { + if (raiseEvent) { // Note: Event is only raised when a tool is added by user + if (needMode) { + // Set complexity mode according to chosen default one + complexityConn.block(true); + complexity->set_active(options.complexity); + complexityConn.block(false); + + // Update GUI accordingly + if (complexity->get_active_row_number() == Normal) { + convertParamToNormal(); + updateGUIToMode(Normal); + } else { + updateGUIToMode(Expert); + } + } + if (listener) { listener->panelChanged(EvlocallabToolAdded, toolName + " (" + escapeHtmlChars(spotName) + ")"); diff --git a/rtgui/options.cc b/rtgui/options.cc index 5a32f604a..b86de1bb4 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -451,7 +451,7 @@ void Options::setDefaults() histogramHeight = 200; histogramDrawMode = 0; curvebboxpos = 1; - complexity = 2; + complexity = 1; prevdemo = PD_Sidecar; rgbDenoiseThreadLimit = 0; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index c283fb824..fa3165110 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -939,16 +939,10 @@ Gtk::Widget* Preferences::getGeneralPanel() complexitylocal = Gtk::manage(new Gtk::ComboBoxText()); setExpandAlignProperties(complexitylocal, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE); complexitylocal->append(M("PREFERENCES_COMPLEXITY_EXP")); - complexitylocal->append(M("PREFERENCES_COMPLEXITY_CONF")); complexitylocal->append(M("PREFERENCES_COMPLEXITY_NORM")); - complexitylocal->set_active(2); - Gtk::Label* complexitylocalRestartL = Gtk::manage(new Gtk::Label(Glib::ustring("(") + M("PREFERENCES_APPLNEXTSTARTUP") + ")")); - setExpandAlignProperties(complexitylocalRestartL, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); + complexitylocal->set_active(1); workflowGrid->attach_next_to(*complexityL, *curveBBoxPosL, Gtk::POS_BOTTOM, 1, 1); workflowGrid->attach_next_to(*complexitylocal, *curveBBoxPosC, Gtk::POS_BOTTOM, 1, 1); - workflowGrid->attach_next_to(*complexitylocalRestartL, *curveBBoxPosRestartL, Gtk::POS_BOTTOM, 1, 1); - - ckbHistogramPositionLeft = Gtk::manage(new Gtk::CheckButton(M("PREFERENCES_HISTOGRAMPOSITIONLEFT"))); setExpandAlignProperties(ckbHistogramPositionLeft, false, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE);