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;