From f59e7c31e4cce25c0d26c913dba64cdd85b1420d Mon Sep 17 00:00:00 2001 From: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com> Date: Sun, 2 Sep 2018 13:39:55 +0200 Subject: [PATCH 1/7] Modifications to store histogram settings across sessions --- rtgui/editorpanel.cc | 2 +- rtgui/histogrampanel.cc | 85 ++++++++++++++++++++--------------------- rtgui/histogrampanel.h | 21 +++++----- rtgui/options.cc | 33 ++++++++++++++++ rtgui/options.h | 3 +- 5 files changed, 89 insertions(+), 55 deletions(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index cb4a58317..3b717abe7 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -2241,7 +2241,7 @@ void EditorPanel::histogramChanged (LUTu & histRed, LUTu & histGreen, LUTu & his { if (histogramPanel) { - histogramPanel->histogramChanged (histRed, histGreen, histBlue, histLuma, histRedRaw, histGreenRaw, histBlueRaw, histChroma); + histogramPanel->histogramChanged (histRed, histGreen, histBlue, histLuma, histChroma, histRedRaw, histGreenRaw, histBlueRaw); } tpc->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI); diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 1d8ce89db..5293c6c00 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -129,14 +129,14 @@ HistogramPanel::HistogramPanel () buttonGrid = Gtk::manage (new Gtk::Grid ()); buttonGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); - showRed->set_active (true); - showGreen->set_active (true); - showBlue->set_active (true); - showValue->set_active (false);//unactive by default - showChro->set_active (false);//unactive by default - showRAW->set_active (false); + showRed->set_active (options.histogramRed); + showGreen->set_active (options.histogramGreen); + showBlue->set_active (options.histogramBlue); + showValue->set_active (options.histogramLuma); + showChro->set_active (options.histogramChroma); + showRAW->set_active (options.histogramRAW); // no showMode->set_active(), as it's not a ToggleButton - showBAR->set_active (options.histogramBar); + showBAR->set_active (options.histogramBar); showRed->set_image (showRed->get_active() ? *redImage : *redImage_g); showGreen->set_image (showGreen->get_active() ? *greenImage : *greenImage_g); @@ -297,12 +297,12 @@ void HistogramPanel::bar_toggled () void HistogramPanel::rgbv_toggled () { // Update Display - histogramArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showRAW->get_active(), showChro->get_active(), options.histogramDrawMode); + histogramArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showChro->get_active(), showRAW->get_active(), options.histogramDrawMode); histogramArea->queue_draw (); - histogramRGBArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showRAW->get_active(), showBAR->get_active(), showChro->get_active()); + histogramRGBArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showChro->get_active(), showRAW->get_active(), showBAR->get_active()); histogramRGBArea->updateBackBuffer (0, 0, 0); - histogramArea->queue_draw (); + histogramRGBArea->queue_draw (); } void HistogramPanel::setHistRGBInvalid () @@ -369,8 +369,11 @@ double HistogramScaling::log(double vsize, double val) // // // HistogramRGBArea -HistogramRGBArea::HistogramRGBArea () ://needChroma unactive by default, luma too - val(0), r(0), g(0), b(0), valid(false), needRed(true), needGreen(true), needBlue(true), needLuma(false), rawMode(false), showMode(options.histogramBar), barDisplayed(options.histogramBar), needChroma(false), parent(nullptr) +HistogramRGBArea::HistogramRGBArea () : + val(0), r(0), g(0), b(0), valid(false), + needRed(options.histogramRed), needGreen(options.histogramGreen), needBlue(options.histogramBlue), + needLuma(options.histogramLuma), needChroma(options.histogramChroma), rawMode(options.histogramRAW), + showMode(options.histogramBar), barDisplayed(options.histogramBar), parent(nullptr) { get_style_context()->add_class("drawingarea"); @@ -583,28 +586,23 @@ void HistogramRGBArea::update (int valh, int rh, int gh, int bh) idle_register.add(func, harih); } -void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, bool bar, bool c) +void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, bool bar) { - needRed = r; - needGreen = g; - needBlue = b; - needLuma = l; - rawMode = raw; - showMode = bar; - needChroma = c; - - // Histogram RGB BAR button logic goes here + options.histogramRed = needRed = r; + options.histogramGreen = needGreen = g; + options.histogramBlue = needBlue = b; + options.histogramLuma = needLuma = l; + options.histogramChroma = needChroma = c; + options.histogramRAW = rawMode = raw; + options.histogramBar = showMode = bar; + // Show/hide the RGB bar widget if (bar && !barDisplayed) { - // Toggled on, add (show) the widget parent->add(*this); - options.histogramBar = true; barDisplayed = true; } else if (!bar && barDisplayed) { - // Toggled off, remove (hide) the widget removeIfThere(parent, this, false); - options.histogramBar = false; barDisplayed = false; } @@ -661,16 +659,18 @@ void HistogramRGBArea::factorChanged (double newFactor) // // // HistogramArea -HistogramArea::HistogramArea (DrawModeListener *fml) : //needChroma unactive by default, luma too +HistogramArea::HistogramArea (DrawModeListener *fml) : valid(false), drawMode(options.histogramDrawMode), myDrawModeListener(fml), - oldwidth(-1), oldheight(-1), needLuma(false), needRed(true), needGreen(true), needBlue(true), - rawMode(false), needChroma(false), isPressed(false), movingPosition(0.0) + oldwidth(-1), oldheight(-1), + needRed(options.histogramRed), needGreen(options.histogramGreen), needBlue(options.histogramBlue), + needLuma(options.histogramLuma), needChroma(options.histogramChroma), rawMode(options.histogramRAW), + isPressed(false), movingPosition(0.0) { - lhist(256); rhist(256); ghist(256); bhist(256); + lhist(256); chist(256); get_style_context()->add_class("drawingarea"); @@ -724,32 +724,31 @@ void HistogramArea::get_preferred_width_for_height_vfunc (int height, int &minim get_preferred_width_vfunc (minimum_width, natural_width); } -void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, bool c, int mode) +void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, int mode) { - - needRed = r; - needGreen = g; - needBlue = b; - needLuma = l; - rawMode = raw; - needChroma = c; - drawMode = mode; + + options.histogramRed = needRed = r; + options.histogramGreen = needGreen = g; + options.histogramBlue = needBlue = b; + options.histogramLuma = needLuma = l; + options.histogramChroma = needChroma = c; + options.histogramRAW = rawMode = raw; + options.histogramDrawMode = drawMode = mode; updateBackBuffer (); } -void HistogramArea::update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma) +void HistogramArea::update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw) { if (histRed) { - lhist = histLuma; - chist = histChroma; rhist = histRed; ghist = histGreen; bhist = histBlue; + lhist = histLuma; + chist = histChroma; rhistRaw = histRedRaw; ghistRaw = histGreenRaw; bhistRaw = histBlueRaw; - valid = true; } else { valid = false; diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index d3788d057..7c2e11162 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -70,10 +70,10 @@ protected: bool needGreen; bool needBlue; bool needLuma; + bool needChroma; bool rawMode; bool showMode; bool barDisplayed; - bool needChroma; Gtk::Grid* parent; @@ -91,7 +91,7 @@ public: }; void update (int val, int rh, int gh, int bh); - void updateOptions (bool r, bool g, bool b, bool l, bool raw, bool show, bool c); + void updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, bool show); void on_realize(); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); @@ -104,7 +104,7 @@ private: void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; void get_preferred_width_for_height_vfunc (int h, int &minimum_width, int &natural_width) const; - // Some ... + }; class DrawModeListener @@ -124,15 +124,16 @@ private: type_signal_factor_changed sigFactorChanged; protected: - LUTu lhist, rhist, ghist, bhist, chist; - LUTu lhistRaw, rhistRaw, ghistRaw, bhistRaw; + LUTu rhist, ghist, bhist, lhist, chist; + LUTu rhistRaw, ghistRaw, bhistRaw, lhistRaw; //lhistRaw is unused? bool valid; int drawMode; DrawModeListener *myDrawModeListener; int oldwidth, oldheight; - bool needLuma, needRed, needGreen, needBlue, rawMode, needChroma; + bool needRed, needGreen, needBlue, needLuma, needChroma; + bool rawMode; bool isPressed; double movingPosition; @@ -143,8 +144,8 @@ public: ~HistogramArea(); void updateBackBuffer (); - void update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma); - void updateOptions (bool r, bool g, bool b, bool l, bool raw, bool c, int mode); + void update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw); + void updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, int mode); void on_realize(); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); @@ -208,9 +209,9 @@ public: HistogramPanel (); ~HistogramPanel (); - void histogramChanged (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma) + void histogramChanged (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw) { - histogramArea->update (histRed, histGreen, histBlue, histLuma, histRedRaw, histGreenRaw, histBlueRaw, histChroma); + histogramArea->update (histRed, histGreen, histBlue, histLuma, histChroma, histRedRaw, histGreenRaw, histBlueRaw); } // pointermotionlistener interface void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw = false); diff --git a/rtgui/options.cc b/rtgui/options.cc index eb920a7d6..9c7e0baf9 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -417,6 +417,9 @@ void Options::setDefaults() mainNBVertical = true; multiDisplayMode = 0; histogramPosition = 1; + histogramRed = true; + histogramGreen = true; + histogramBlue = true; histogramBar = true; histogramHeight = 200; histogramDrawMode = 0; @@ -1305,6 +1308,30 @@ void Options::readFromFile(Glib::ustring fname) if (keyFile.has_key("GUI", "HistogramPosition")) { histogramPosition = keyFile.get_integer("GUI", "HistogramPosition"); } + + if (keyFile.has_key("GUI", "HistogramRed")) { + histogramRed = keyFile.get_boolean("GUI", "HistogramRed"); + } + + if (keyFile.has_key("GUI", "HistogramGreen")) { + histogramGreen = keyFile.get_boolean("GUI", "HistogramGreen"); + } + + if (keyFile.has_key("GUI", "HistogramBlue")) { + histogramBlue = keyFile.get_boolean("GUI", "HistogramBlue"); + } + + if (keyFile.has_key("GUI", "HistogramLuma")) { + histogramLuma = keyFile.get_boolean("GUI", "HistogramLuma"); + } + + if (keyFile.has_key("GUI", "HistogramChroma")) { + histogramChroma = keyFile.get_boolean("GUI", "HistogramChroma"); + } + + if (keyFile.has_key("GUI", "HistogramRAW")) { + histogramRAW = keyFile.get_boolean("GUI", "HistogramRAW"); + } if (keyFile.has_key("GUI", "HistogramBar")) { histogramBar = keyFile.get_boolean("GUI", "HistogramBar"); @@ -2035,6 +2062,12 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush); keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush); keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition); + keyFile.set_boolean ("GUI", "HistogramRed", histogramRed); + keyFile.set_boolean ("GUI", "HistogramGreen", histogramGreen); + keyFile.set_boolean ("GUI", "HistogramBlue", histogramBlue); + keyFile.set_boolean ("GUI", "HistogramLuma", histogramLuma); + keyFile.set_boolean ("GUI", "HistogramChroma", histogramChroma); + keyFile.set_boolean ("GUI", "HistogramRAW", histogramRAW); keyFile.set_boolean ("GUI", "HistogramBar", histogramBar); keyFile.set_integer ("GUI", "HistogramHeight", histogramHeight); keyFile.set_integer ("GUI", "HistogramDrawMode", histogramDrawMode); diff --git a/rtgui/options.h b/rtgui/options.h index 93f29b7ac..149fa2135 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -254,7 +254,8 @@ public: bool sndEnable; int histogramPosition; // 0=disabled, 1=left pane, 2=right pane - //int histogramWorking; // 0=disabled, 1=left pane, 2=right pane + bool histogramRed, histogramGreen, histogramBlue; + bool histogramLuma, histogramChroma, histogramRAW; bool histogramBar; int histogramHeight; int histogramDrawMode; From 59ca037fd75ab97a6127b7d528004661e915d970 Mon Sep 17 00:00:00 2001 From: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com> Date: Sun, 2 Sep 2018 16:58:20 +0200 Subject: [PATCH 2/7] Disable highlight recovery threshold when highlight recovery = 0 and set threshold default to 0 --- rtengine/improcfun.cc | 2 +- rtengine/procparams.cc | 2 +- rtgui/tonecurve.cc | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 945eaf29f..7d9d080e2 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -5466,7 +5466,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double //now tune hlcompr to bring back rawmax to 65535 - hlcomprthresh = 33; + hlcomprthresh = 0; //this is a series approximation of the actual formula for comp, //which is a transcendental equation float comp = (gain * ((float)whiteclip) / scale - 1.f) * 2.3f; // 2.3 instead of 2 to increase slightly comp diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index e7225e993..90c472290 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -330,7 +330,7 @@ ToneCurveParams::ToneCurveParams() : saturation(0), shcompr(50), hlcompr(0), - hlcomprthresh(33), + hlcomprthresh(0), histmatching(false), fromHistMatching(false), clampOOG(true) diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 30c9dadee..1354dd81b 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -111,7 +111,7 @@ ToneCurve::ToneCurve () : FoldableToolPanel(this, "tonecurve", M("TP_EXPOSURE_LA //----------- Highlight recovery & threshold ------------- hlcompr = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTS"), 0, 500, 1, 0)); pack_start (*hlcompr); - hlcomprthresh = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 33)); + hlcomprthresh = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRHIGHLIGHTSTHRESHOLD"), 0, 100, 1, 0)); pack_start (*hlcomprthresh); //----------- Black Level & Compression ------------------- @@ -232,6 +232,10 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) if (!black->getAddMode()) { shcompr->set_sensitive(!((int)black->getValue () == 0)); //at black=0 shcompr value has no effect } + + if (!hlcompr->getAddMode()) { + hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect + } brightness->setValue (pp->toneCurve.brightness); contrast->setValue (pp->toneCurve.contrast); @@ -620,6 +624,10 @@ void ToneCurve::adjusterChanged (Adjuster* a, double newval) listener->panelChanged (EvSaturation, costr); } else if (a == hlcompr) { listener->panelChanged (EvHLCompr, costr); + + if (!hlcompr->getAddMode()) { + hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect + } } else if (a == hlcomprthresh) { listener->panelChanged (EvHLComprThreshold, costr); } else if (a == shcompr) { @@ -663,6 +671,10 @@ void ToneCurve::neutral_pressed () if (!black->getAddMode()) { shcompr->set_sensitive(!((int)black->getValue () == 0)); //at black=0 shcompr value has no effect } + + if (!hlcompr->getAddMode()) { + hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect + } contrast->setValue(0); //saturation->setValue(0); From 30b36e63712f651c0f3ada6e233f8fed8352602f Mon Sep 17 00:00:00 2001 From: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com> Date: Sun, 2 Sep 2018 17:04:17 +0200 Subject: [PATCH 3/7] Revert "Modifications to store histogram settings across sessions" This reverts commit f59e7c31e4cce25c0d26c913dba64cdd85b1420d. --- rtgui/editorpanel.cc | 2 +- rtgui/histogrampanel.cc | 85 +++++++++++++++++++++-------------------- rtgui/histogrampanel.h | 21 +++++----- rtgui/options.cc | 33 ---------------- rtgui/options.h | 3 +- 5 files changed, 55 insertions(+), 89 deletions(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 3f0909d88..c99ed2dbd 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -2242,7 +2242,7 @@ void EditorPanel::histogramChanged (LUTu & histRed, LUTu & histGreen, LUTu & his { if (histogramPanel) { - histogramPanel->histogramChanged (histRed, histGreen, histBlue, histLuma, histChroma, histRedRaw, histGreenRaw, histBlueRaw); + histogramPanel->histogramChanged (histRed, histGreen, histBlue, histLuma, histRedRaw, histGreenRaw, histBlueRaw, histChroma); } tpc->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI); diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 5293c6c00..1d8ce89db 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -129,14 +129,14 @@ HistogramPanel::HistogramPanel () buttonGrid = Gtk::manage (new Gtk::Grid ()); buttonGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); - showRed->set_active (options.histogramRed); - showGreen->set_active (options.histogramGreen); - showBlue->set_active (options.histogramBlue); - showValue->set_active (options.histogramLuma); - showChro->set_active (options.histogramChroma); - showRAW->set_active (options.histogramRAW); + showRed->set_active (true); + showGreen->set_active (true); + showBlue->set_active (true); + showValue->set_active (false);//unactive by default + showChro->set_active (false);//unactive by default + showRAW->set_active (false); // no showMode->set_active(), as it's not a ToggleButton - showBAR->set_active (options.histogramBar); + showBAR->set_active (options.histogramBar); showRed->set_image (showRed->get_active() ? *redImage : *redImage_g); showGreen->set_image (showGreen->get_active() ? *greenImage : *greenImage_g); @@ -297,12 +297,12 @@ void HistogramPanel::bar_toggled () void HistogramPanel::rgbv_toggled () { // Update Display - histogramArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showChro->get_active(), showRAW->get_active(), options.histogramDrawMode); + histogramArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showRAW->get_active(), showChro->get_active(), options.histogramDrawMode); histogramArea->queue_draw (); - histogramRGBArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showChro->get_active(), showRAW->get_active(), showBAR->get_active()); + histogramRGBArea->updateOptions (showRed->get_active(), showGreen->get_active(), showBlue->get_active(), showValue->get_active(), showRAW->get_active(), showBAR->get_active(), showChro->get_active()); histogramRGBArea->updateBackBuffer (0, 0, 0); - histogramRGBArea->queue_draw (); + histogramArea->queue_draw (); } void HistogramPanel::setHistRGBInvalid () @@ -369,11 +369,8 @@ double HistogramScaling::log(double vsize, double val) // // // HistogramRGBArea -HistogramRGBArea::HistogramRGBArea () : - val(0), r(0), g(0), b(0), valid(false), - needRed(options.histogramRed), needGreen(options.histogramGreen), needBlue(options.histogramBlue), - needLuma(options.histogramLuma), needChroma(options.histogramChroma), rawMode(options.histogramRAW), - showMode(options.histogramBar), barDisplayed(options.histogramBar), parent(nullptr) +HistogramRGBArea::HistogramRGBArea () ://needChroma unactive by default, luma too + val(0), r(0), g(0), b(0), valid(false), needRed(true), needGreen(true), needBlue(true), needLuma(false), rawMode(false), showMode(options.histogramBar), barDisplayed(options.histogramBar), needChroma(false), parent(nullptr) { get_style_context()->add_class("drawingarea"); @@ -586,23 +583,28 @@ void HistogramRGBArea::update (int valh, int rh, int gh, int bh) idle_register.add(func, harih); } -void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, bool bar) +void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, bool bar, bool c) { - options.histogramRed = needRed = r; - options.histogramGreen = needGreen = g; - options.histogramBlue = needBlue = b; - options.histogramLuma = needLuma = l; - options.histogramChroma = needChroma = c; - options.histogramRAW = rawMode = raw; - options.histogramBar = showMode = bar; + needRed = r; + needGreen = g; + needBlue = b; + needLuma = l; + rawMode = raw; + showMode = bar; + needChroma = c; + + // Histogram RGB BAR button logic goes here - // Show/hide the RGB bar widget if (bar && !barDisplayed) { + // Toggled on, add (show) the widget parent->add(*this); + options.histogramBar = true; barDisplayed = true; } else if (!bar && barDisplayed) { + // Toggled off, remove (hide) the widget removeIfThere(parent, this, false); + options.histogramBar = false; barDisplayed = false; } @@ -659,18 +661,16 @@ void HistogramRGBArea::factorChanged (double newFactor) // // // HistogramArea -HistogramArea::HistogramArea (DrawModeListener *fml) : +HistogramArea::HistogramArea (DrawModeListener *fml) : //needChroma unactive by default, luma too valid(false), drawMode(options.histogramDrawMode), myDrawModeListener(fml), - oldwidth(-1), oldheight(-1), - needRed(options.histogramRed), needGreen(options.histogramGreen), needBlue(options.histogramBlue), - needLuma(options.histogramLuma), needChroma(options.histogramChroma), rawMode(options.histogramRAW), - isPressed(false), movingPosition(0.0) + oldwidth(-1), oldheight(-1), needLuma(false), needRed(true), needGreen(true), needBlue(true), + rawMode(false), needChroma(false), isPressed(false), movingPosition(0.0) { + lhist(256); rhist(256); ghist(256); bhist(256); - lhist(256); chist(256); get_style_context()->add_class("drawingarea"); @@ -724,31 +724,32 @@ void HistogramArea::get_preferred_width_for_height_vfunc (int height, int &minim get_preferred_width_vfunc (minimum_width, natural_width); } -void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, int mode) +void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool raw, bool c, int mode) { - - options.histogramRed = needRed = r; - options.histogramGreen = needGreen = g; - options.histogramBlue = needBlue = b; - options.histogramLuma = needLuma = l; - options.histogramChroma = needChroma = c; - options.histogramRAW = rawMode = raw; - options.histogramDrawMode = drawMode = mode; + + needRed = r; + needGreen = g; + needBlue = b; + needLuma = l; + rawMode = raw; + needChroma = c; + drawMode = mode; updateBackBuffer (); } -void HistogramArea::update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw) +void HistogramArea::update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma) { if (histRed) { + lhist = histLuma; + chist = histChroma; rhist = histRed; ghist = histGreen; bhist = histBlue; - lhist = histLuma; - chist = histChroma; rhistRaw = histRedRaw; ghistRaw = histGreenRaw; bhistRaw = histBlueRaw; + valid = true; } else { valid = false; diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index 7c2e11162..d3788d057 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -70,10 +70,10 @@ protected: bool needGreen; bool needBlue; bool needLuma; - bool needChroma; bool rawMode; bool showMode; bool barDisplayed; + bool needChroma; Gtk::Grid* parent; @@ -91,7 +91,7 @@ public: }; void update (int val, int rh, int gh, int bh); - void updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, bool show); + void updateOptions (bool r, bool g, bool b, bool l, bool raw, bool show, bool c); void on_realize(); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); @@ -104,7 +104,7 @@ private: void get_preferred_width_vfunc (int &minimum_width, int &natural_width) const; void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; void get_preferred_width_for_height_vfunc (int h, int &minimum_width, int &natural_width) const; - + // Some ... }; class DrawModeListener @@ -124,16 +124,15 @@ private: type_signal_factor_changed sigFactorChanged; protected: - LUTu rhist, ghist, bhist, lhist, chist; - LUTu rhistRaw, ghistRaw, bhistRaw, lhistRaw; //lhistRaw is unused? + LUTu lhist, rhist, ghist, bhist, chist; + LUTu lhistRaw, rhistRaw, ghistRaw, bhistRaw; bool valid; int drawMode; DrawModeListener *myDrawModeListener; int oldwidth, oldheight; - bool needRed, needGreen, needBlue, needLuma, needChroma; - bool rawMode; + bool needLuma, needRed, needGreen, needBlue, rawMode, needChroma; bool isPressed; double movingPosition; @@ -144,8 +143,8 @@ public: ~HistogramArea(); void updateBackBuffer (); - void update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw); - void updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, int mode); + void update (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma); + void updateOptions (bool r, bool g, bool b, bool l, bool raw, bool c, int mode); void on_realize(); bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr); bool on_button_press_event (GdkEventButton* event); @@ -209,9 +208,9 @@ public: HistogramPanel (); ~HistogramPanel (); - void histogramChanged (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histChroma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw) + void histogramChanged (LUTu &histRed, LUTu &histGreen, LUTu &histBlue, LUTu &histLuma, LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw, LUTu &histChroma) { - histogramArea->update (histRed, histGreen, histBlue, histLuma, histChroma, histRedRaw, histGreenRaw, histBlueRaw); + histogramArea->update (histRed, histGreen, histBlue, histLuma, histRedRaw, histGreenRaw, histBlueRaw, histChroma); } // pointermotionlistener interface void pointerMoved (bool validPos, const Glib::ustring &profile, const Glib::ustring &profileW, int x, int y, int r, int g, int b, bool isRaw = false); diff --git a/rtgui/options.cc b/rtgui/options.cc index 8107b43f0..0190b7d40 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -419,9 +419,6 @@ void Options::setDefaults() mainNBVertical = true; multiDisplayMode = 0; histogramPosition = 1; - histogramRed = true; - histogramGreen = true; - histogramBlue = true; histogramBar = true; histogramHeight = 200; histogramDrawMode = 0; @@ -1318,30 +1315,6 @@ void Options::readFromFile(Glib::ustring fname) if (keyFile.has_key("GUI", "HistogramPosition")) { histogramPosition = keyFile.get_integer("GUI", "HistogramPosition"); } - - if (keyFile.has_key("GUI", "HistogramRed")) { - histogramRed = keyFile.get_boolean("GUI", "HistogramRed"); - } - - if (keyFile.has_key("GUI", "HistogramGreen")) { - histogramGreen = keyFile.get_boolean("GUI", "HistogramGreen"); - } - - if (keyFile.has_key("GUI", "HistogramBlue")) { - histogramBlue = keyFile.get_boolean("GUI", "HistogramBlue"); - } - - if (keyFile.has_key("GUI", "HistogramLuma")) { - histogramLuma = keyFile.get_boolean("GUI", "HistogramLuma"); - } - - if (keyFile.has_key("GUI", "HistogramChroma")) { - histogramChroma = keyFile.get_boolean("GUI", "HistogramChroma"); - } - - if (keyFile.has_key("GUI", "HistogramRAW")) { - histogramRAW = keyFile.get_boolean("GUI", "HistogramRAW"); - } if (keyFile.has_key("GUI", "HistogramBar")) { histogramBar = keyFile.get_boolean("GUI", "HistogramBar"); @@ -2074,12 +2047,6 @@ void Options::saveToFile(Glib::ustring fname) keyFile.set_double_list ("GUI", "CutOverlayBrush", cutOverlayBrush); keyFile.set_double_list ("GUI", "NavGuideBrush", navGuideBrush); keyFile.set_integer ("GUI", "HistogramPosition", histogramPosition); - keyFile.set_boolean ("GUI", "HistogramRed", histogramRed); - keyFile.set_boolean ("GUI", "HistogramGreen", histogramGreen); - keyFile.set_boolean ("GUI", "HistogramBlue", histogramBlue); - keyFile.set_boolean ("GUI", "HistogramLuma", histogramLuma); - keyFile.set_boolean ("GUI", "HistogramChroma", histogramChroma); - keyFile.set_boolean ("GUI", "HistogramRAW", histogramRAW); keyFile.set_boolean ("GUI", "HistogramBar", histogramBar); keyFile.set_integer ("GUI", "HistogramHeight", histogramHeight); keyFile.set_integer ("GUI", "HistogramDrawMode", histogramDrawMode); diff --git a/rtgui/options.h b/rtgui/options.h index 6c473949b..ee95d5cb3 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -256,8 +256,7 @@ public: bool sndEnable; int histogramPosition; // 0=disabled, 1=left pane, 2=right pane - bool histogramRed, histogramGreen, histogramBlue; - bool histogramLuma, histogramChroma, histogramRAW; + //int histogramWorking; // 0=disabled, 1=left pane, 2=right pane bool histogramBar; int histogramHeight; int histogramDrawMode; From 7b0a9c01c5832d74a1e7d2b4bf1bd44ca7ddb36f Mon Sep 17 00:00:00 2001 From: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com> Date: Sun, 2 Sep 2018 20:40:11 +0200 Subject: [PATCH 4/7] Fix for usability of highlight threshold slider and shadow compression in batch mode --- rtgui/tonecurve.cc | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 1354dd81b..5205d6f18 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -229,11 +229,11 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) hlcomprthresh->setValue (pp->toneCurve.hlcomprthresh); shcompr->setValue (pp->toneCurve.shcompr); - if (!black->getAddMode()) { + if (!black->getAddMode() && !batchMode) { shcompr->set_sensitive(!((int)black->getValue () == 0)); //at black=0 shcompr value has no effect } - if (!hlcompr->getAddMode()) { + if (!hlcompr->getAddMode() && !batchMode) { hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect } @@ -615,7 +615,7 @@ void ToneCurve::adjusterChanged (Adjuster* a, double newval) } else if (a == black) { listener->panelChanged (EvBlack, costr); - if (!black->getAddMode()) { + if (!black->getAddMode() && !batchMode) { shcompr->set_sensitive(!((int)black->getValue () == 0)); //at black=0 shcompr value has no effect } } else if (a == contrast) { @@ -625,7 +625,7 @@ void ToneCurve::adjusterChanged (Adjuster* a, double newval) } else if (a == hlcompr) { listener->panelChanged (EvHLCompr, costr); - if (!hlcompr->getAddMode()) { + if (!hlcompr->getAddMode() && !batchMode) { hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect } } else if (a == hlcomprthresh) { @@ -668,11 +668,11 @@ void ToneCurve::neutral_pressed () hlrbox->hide(); } - if (!black->getAddMode()) { + if (!black->getAddMode() && !batchMode) { shcompr->set_sensitive(!((int)black->getValue () == 0)); //at black=0 shcompr value has no effect } - if (!hlcompr->getAddMode()) { + if (!hlcompr->getAddMode() && !batchMode) { hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect } @@ -745,6 +745,11 @@ void ToneCurve::autolevels_toggled () if (!black->getAddMode()) { shcompr->set_sensitive(!((int)black->getValue () == 0)); //at black=0 shcompr value has no effect } + + if (!hlcompr->getAddMode() && !batchMode) { + hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect + } + } else { listener->panelChanged (EvFixedExp, M("GENERAL_DISABLED")); } @@ -859,9 +864,13 @@ bool ToneCurve::autoExpComputed_ () hlrbox->hide(); } - if (!black->getAddMode()) { + if (!black->getAddMode() && !batchMode) { shcompr->set_sensitive(!((int)black->getValue () == 0)); //at black=0 shcompr value has no effect } + + if (!hlcompr->getAddMode() && !batchMode) { + hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect + } enableListener (); @@ -983,9 +992,13 @@ bool ToneCurve::histmatchingComputed() contrast->setValue(0); black->setValue(0); - if (!black->getAddMode()) { + if (!black->getAddMode() && !batchMode) { shcompr->set_sensitive(!((int)black->getValue() == 0)); } + + if (!hlcompr->getAddMode() && !batchMode) { + hlcomprthresh->set_sensitive(!((int)hlcompr->getValue () == 0)); //at hlcompr=0 hlcomprthresh value has no effect + } if (autolevels->get_active() ) { expcomp->setValue(0); From caffc3a23dea682c6706fb5728a16c16c5f4b2c0 Mon Sep 17 00:00:00 2001 From: Hombre Date: Thu, 6 Sep 2018 23:10:16 +0200 Subject: [PATCH 5/7] Bugfix: the scrollable toolbars was freezing under some circumstances --- rtgui/guiutils.cc | 22 +++++++++++++++++++++- rtgui/guiutils.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 447c9d8af..1e4f4eac8 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -991,8 +991,11 @@ void MyScrolledWindow::get_preferred_height_for_width_vfunc (int width, int &min MyScrolledToolbar::MyScrolledToolbar () { set_policy (Gtk::POLICY_EXTERNAL, Gtk::POLICY_NEVER); - set_propagate_natural_height(true); get_style_context()->add_class("scrollableToolbar"); + + // Works fine with Gtk 3.22, but a a custom made get_preferred_height had to be created as a workaround + // taken from the official Gtk3.22 source code + //set_propagate_natural_height(true); } bool MyScrolledToolbar::on_scroll_event (GdkEventScroll* event) @@ -1032,6 +1035,23 @@ bool MyScrolledToolbar::on_scroll_event (GdkEventScroll* event) return true; } +void MyScrolledToolbar::get_preferred_height (int &minimumHeight, int &naturalHeight) +{ + int currMinHeight = 0; + int currNatHeight = 0; + std::vector childs = get_children(); + minimumHeight = naturalHeight = 0; + + for (auto child : childs) + { + if(child->is_visible()) { + child->get_preferred_height(currMinHeight, currNatHeight); + minimumHeight = rtengine::max(currMinHeight, minimumHeight); + naturalHeight = rtengine::max(currNatHeight, naturalHeight); + } + } +} + MyComboBoxText::MyComboBoxText (bool has_entry) : Gtk::ComboBoxText(has_entry) { minimumWidth = naturalWidth = 70; diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index 89d05bfce..fb627a78a 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -300,6 +300,7 @@ class MyScrolledToolbar : public Gtk::ScrolledWindow { bool on_scroll_event (GdkEventScroll* event); + void get_preferred_height (int &minimumHeight, int &naturalHeight); public: MyScrolledToolbar(); From 8e678c285a4bb241f5ebbbac546c30153dd78660 Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 10 Sep 2018 02:33:20 -0700 Subject: [PATCH 6/7] support camera dng LEICA M MONOCHROM (Typ 246) Patch by @heckflosse https://github.com/Beep6581/RawTherapee/issues/4785#issuecomment-419713993 --- rtengine/dcraw.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index ccfd16187..bd9fa4b47 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -1136,7 +1136,7 @@ void CLASS lossless_dng_load_raw() fseek (ifp, get4(), SEEK_SET); if (!ljpeg_start (&jh, 0)) break; jwide = jh.wide; - if (filters) jwide *= jh.clrs; + if (filters || (colors == 1 && jh.clrs > 1)) jwide *= jh.clrs; jwide /= MIN (is_raw, tiff_samples); switch (jh.algo) { case 0xc1: From a42b2236d977ee4071c285396e82d29bb5c4fbbc Mon Sep 17 00:00:00 2001 From: Benitoite Date: Mon, 10 Sep 2018 11:43:31 -0700 Subject: [PATCH 7/7] save format panel PNG options fix Patch by @heckflosse https://github.com/Beep6581/RawTherapee/issues/4789 --- rtgui/saveformatpanel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/saveformatpanel.cc b/rtgui/saveformatpanel.cc index 2a6d5cad1..755cb9239 100644 --- a/rtgui/saveformatpanel.cc +++ b/rtgui/saveformatpanel.cc @@ -182,7 +182,7 @@ void SaveFormatPanel::formatChanged () int act = format->get_active_row_number(); - if (act < 0 || act > 5) { + if (act < 0 || act > 6) { return; }