From 63a6e1b79cc4a6033c2fcb77b74d78857423829b Mon Sep 17 00:00:00 2001 From: rom9 <4711834+rom9@users.noreply.github.com> Date: Wed, 26 Jun 2019 01:06:48 +0200 Subject: [PATCH] Changed GUI behaviour so that the first slider sets the reference exponent (green channel), and the other two sliders set the ratio of the red/blue exponent to the reference one. This should be more intuitive, and less confusing when clicking on the reset-to-default slider button. Now the first slider sets the general contrast, while the other two affect the color. Lowered exponent slider max value from 6 to 4 (it was too large to be useful). New sliders are log-scale. --- rtdata/languages/default | 6 +-- rtgui/filmnegative.cc | 87 +++++++++++++++++----------------------- rtgui/filmnegative.h | 7 +--- 3 files changed, 42 insertions(+), 58 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 79fdc5729..63c877bbf 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1638,12 +1638,12 @@ TP_EXPOSURE_TCMODE_STANDARD;Standard TP_EXPOSURE_TCMODE_WEIGHTEDSTD;Weighted Standard TP_EXPOS_BLACKPOINT_LABEL;Raw Black Points TP_EXPOS_WHITEPOINT_LABEL;Raw White Points -TP_FILMNEGATIVE_BLUE;Blue exponent -TP_FILMNEGATIVE_GREEN;Green exponent (lead) +TP_FILMNEGATIVE_BLUE;Blue ratio +TP_FILMNEGATIVE_GREEN;Reference exponent (contrast) TP_FILMNEGATIVE_GUESS_TOOLTIP;Calculate exponents by picking 2 neutral reference spots in the image; one white (light gray) and one black (dark gray).\nThe order does not matter. The exponents will be updated after the second spot is picked. TP_FILMNEGATIVE_LABEL;Film Negative TP_FILMNEGATIVE_PICK;Pick white and black spots -TP_FILMNEGATIVE_RED;Red exponent +TP_FILMNEGATIVE_RED;Red ratio TP_FILMNEGATIVE_REF_SPOTS;Film negative reference spots TP_FILMSIMULATION_LABEL;Film Simulation TP_FILMSIMULATION_SLOWPARSEDIR;RawTherapee is configured to look for Hald CLUT images, which are used for the Film Simulation tool, in a folder which is taking too long to load.\nGo to Preferences > Image Processing > Film Simulation\nto see which folder is being used. You should either point RawTherapee to a folder which contains only Hald CLUT images and nothing more, or to an empty folder if you don't want to use the Film Simulation tool.\n\nRead the Film Simulation article in RawPedia for more information.\n\nDo you want to cancel the scan now? diff --git a/rtgui/filmnegative.cc b/rtgui/filmnegative.cc index d84c1bd0a..129af3034 100644 --- a/rtgui/filmnegative.cc +++ b/rtgui/filmnegative.cc @@ -30,11 +30,15 @@ namespace { -Adjuster* createExponentAdjuster(AdjusterListener* listener, const Glib::ustring& label, double defaultVal) +Adjuster* createExponentAdjuster(AdjusterListener* listener, const Glib::ustring& label, double minV, double maxV, double defaultVal, bool log) { - Adjuster* const adj = Gtk::manage(new Adjuster(label, 0.3, 6, 0.001, defaultVal)); // exponent + Adjuster* const adj = Gtk::manage(new Adjuster(label, minV, maxV, 0.001, defaultVal)); // exponent adj->setAdjusterListener(listener); + if (log) { + adj->setLogScale(10, minV, false); + } + if (adj->delay < options.adjusterMaxDelay) { adj->delay = options.adjusterMaxDelay; } @@ -51,13 +55,11 @@ FilmNegative::FilmNegative() : evFilmNegativeExponents(ProcEventMapper::getInstance()->newEvent(FIRST, "HISTORY_MSG_FILMNEGATIVE_EXPONENTS")), evFilmNegativeEnabled(ProcEventMapper::getInstance()->newEvent(FIRST, "HISTORY_MSG_FILMNEGATIVE_ENABLED")), fnp(nullptr), - redExp(createExponentAdjuster(this, M("TP_FILMNEGATIVE_RED"), 2.72)), - greenExp(createExponentAdjuster(this, M("TP_FILMNEGATIVE_GREEN"), 2.0)), - blueExp(createExponentAdjuster(this, M("TP_FILMNEGATIVE_BLUE"), 1.72)), + greenExp(createExponentAdjuster(this, M("TP_FILMNEGATIVE_GREEN"), 0.3, 4, 2.0, false)), + redRatio(createExponentAdjuster(this, M("TP_FILMNEGATIVE_RED"), 0.3, 3, 1.36, true)), + blueRatio(createExponentAdjuster(this, M("TP_FILMNEGATIVE_BLUE"), 0.3, 3, 0.86, true)), spotgrid(Gtk::manage(new Gtk::Grid())), - spotbutton(Gtk::manage(new Gtk::ToggleButton(M("TP_FILMNEGATIVE_PICK")))), - redRatio(redExp->getValue() / greenExp->getValue()), - blueRatio(blueExp->getValue() / greenExp->getValue()) + spotbutton(Gtk::manage(new Gtk::ToggleButton(M("TP_FILMNEGATIVE_PICK")))) { spotgrid->get_style_context()->add_class("grid-spacing"); setExpandAlignProperties(spotgrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); @@ -86,9 +88,9 @@ FilmNegative::FilmNegative() : // spotgrid->attach (*slab, 1, 0, 1, 1); // spotgrid->attach (*wbsizehelper, 2, 0, 1, 1); - pack_start(*redExp, Gtk::PACK_SHRINK, 0); pack_start(*greenExp, Gtk::PACK_SHRINK, 0); - pack_start(*blueExp, Gtk::PACK_SHRINK, 0); + pack_start(*redRatio, Gtk::PACK_SHRINK, 0); + pack_start(*blueRatio, Gtk::PACK_SHRINK, 0); pack_start(*spotgrid, Gtk::PACK_SHRINK, 0); spotbutton->signal_toggled().connect(sigc::mem_fun(*this, &FilmNegative::editToggled)); @@ -124,49 +126,49 @@ void FilmNegative::read(const rtengine::procparams::ProcParams* pp, const Params disableListener(); if (pedited) { - redExp->setEditedState(pedited->filmNegative.redExp ? Edited : UnEdited); + redRatio->setEditedState(pedited->filmNegative.redExp ? Edited : UnEdited); greenExp->setEditedState(pedited->filmNegative.greenExp ? Edited : UnEdited); - blueExp->setEditedState(pedited->filmNegative.blueExp ? Edited : UnEdited); + blueRatio->setEditedState(pedited->filmNegative.blueExp ? Edited : UnEdited); set_inconsistent(multiImage && !pedited->filmNegative.enabled); } setEnabled(pp->filmNegative.enabled); - redExp->setValue(pp->filmNegative.redExp); + redRatio->setValue(pp->filmNegative.redExp / pp->filmNegative.greenExp); greenExp->setValue(pp->filmNegative.greenExp); - blueExp->setValue(pp->filmNegative.blueExp); + blueRatio->setValue(pp->filmNegative.blueExp / pp->filmNegative.greenExp); enableListener(); } void FilmNegative::write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited) { - pp->filmNegative.redExp = redExp->getValue(); + pp->filmNegative.redExp = greenExp->getValue() * redRatio->getValue(); pp->filmNegative.greenExp = greenExp->getValue(); - pp->filmNegative.blueExp = blueExp->getValue(); + pp->filmNegative.blueExp = greenExp->getValue() * blueRatio->getValue(); pp->filmNegative.enabled = getEnabled(); if (pedited) { - pedited->filmNegative.redExp = redExp->getEditedState(); + pedited->filmNegative.redExp = greenExp->getEditedState() || redRatio->getEditedState(); pedited->filmNegative.greenExp = greenExp->getEditedState(); - pedited->filmNegative.blueExp = blueExp->getEditedState(); + pedited->filmNegative.blueExp = greenExp->getEditedState() || blueRatio->getEditedState(); pedited->filmNegative.enabled = !get_inconsistent(); } } void FilmNegative::setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited) { - redExp->setValue(defParams->filmNegative.redExp); + redRatio->setValue(defParams->filmNegative.redExp / defParams->filmNegative.greenExp); greenExp->setValue(defParams->filmNegative.greenExp); - blueExp->setValue(defParams->filmNegative.blueExp); + blueRatio->setValue(defParams->filmNegative.blueExp / defParams->filmNegative.greenExp); if (pedited) { - redExp->setDefaultEditedState(pedited->filmNegative.redExp ? Edited : UnEdited); + redRatio->setDefaultEditedState(pedited->filmNegative.redExp ? Edited : UnEdited); greenExp->setDefaultEditedState(pedited->filmNegative.greenExp ? Edited : UnEdited); - blueExp->setDefaultEditedState(pedited->filmNegative.blueExp ? Edited : UnEdited); + blueRatio->setDefaultEditedState(pedited->filmNegative.blueExp ? Edited : UnEdited); } else { - redExp->setDefaultEditedState(Irrelevant); + redRatio->setDefaultEditedState(Irrelevant); greenExp->setDefaultEditedState(Irrelevant); - blueExp->setDefaultEditedState(Irrelevant); + blueRatio->setDefaultEditedState(Irrelevant); } } @@ -176,37 +178,24 @@ void FilmNegative::setBatchMode(bool batchMode) spotConn.disconnect(); removeIfThere(this, spotgrid, false); ToolPanel::setBatchMode(batchMode); - redExp->showEditedCB(); + redRatio->showEditedCB(); greenExp->showEditedCB(); - blueExp->showEditedCB(); + blueRatio->showEditedCB(); } } void FilmNegative::adjusterChanged(Adjuster* a, double newval) { if (listener) { - if (a == redExp || a == greenExp || a == blueExp) { - disableListener(); - if (a == greenExp) { - redExp->setValue(a->getValue() * redRatio); - blueExp->setValue(a->getValue() * blueRatio); - } - else if (a == redExp) { - redRatio = newval / greenExp->getValue(); - } - else if (a == blueExp) { - blueRatio = newval / greenExp->getValue(); - } - enableListener(); - + if (a == redRatio || a == greenExp || a == blueRatio) { if (getEnabled()) { listener->panelChanged( evFilmNegativeExponents, Glib::ustring::compose( "R=%1 ; G=%2 ; B=%3", - redExp->getTextValue(), - greenExp->getTextValue(), - blueExp->getTextValue() + greenExp->getValue() * redRatio->getValue(), + greenExp->getValue(), + greenExp->getValue() * blueRatio->getValue() ) ); } @@ -275,10 +264,8 @@ bool FilmNegative::button1Pressed(int modifierKey) disableListener(); // Leaving green exponent unchanged, setting red and blue exponents based on // the ratios between newly calculated exponents. - redRatio = newExps[0] / newExps[1]; - blueRatio = newExps[2] / newExps[1]; - redExp->setValue(greenExp->getValue() * redRatio); - blueExp->setValue(greenExp->getValue() * blueRatio); + redRatio->setValue(newExps[0] / newExps[1]); + blueRatio->setValue(newExps[2] / newExps[1]); enableListener(); if (listener && getEnabled()) { @@ -286,9 +273,9 @@ bool FilmNegative::button1Pressed(int modifierKey) evFilmNegativeExponents, Glib::ustring::compose( "R=%1 ; G=%2 ; B=%3", - redExp->getTextValue(), - greenExp->getTextValue(), - blueExp->getTextValue() + greenExp->getValue() * redRatio->getValue(), + greenExp->getValue(), + greenExp->getValue() * blueRatio->getValue() ) ); } diff --git a/rtgui/filmnegative.h b/rtgui/filmnegative.h index b8aa338c6..7de1bd56a 100644 --- a/rtgui/filmnegative.h +++ b/rtgui/filmnegative.h @@ -79,14 +79,11 @@ private: FilmNegProvider* fnp; - Adjuster* const redExp; Adjuster* const greenExp; - Adjuster* const blueExp; + Adjuster* const redRatio; + Adjuster* const blueRatio; Gtk::Grid* const spotgrid; Gtk::ToggleButton* const spotbutton; sigc::connection spotConn; - - double redRatio; - double blueRatio; };