From c03efe4878e132a05b27abb3f92c0b79c9e06db0 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Sat, 12 Sep 2020 17:52:24 -0700 Subject: [PATCH] Add dedicated buttons for scope switching Previously, changing to a different scope was done by clicking the scope type button and cycling through all scopes. This commit decreases the number of clicks needed to switch between two scopes by adding a radio selector. The radio buttons can be shown or hidden by pressing the scope type button. This commit also makes the raw histogram one of the scope types. --- .../histogram-type-histogram-off-small.svg | 122 ++++++++ ...istogram-type-vectorscope-hc-off-small.svg | 131 ++++++++ ...istogram-type-vectorscope-hs-off-small.svg | 135 ++++++++ .../svg/histogram-type-waveform-off-small.svg | 122 ++++++++ rtdata/languages/default | 7 +- rtengine/improccoordinator.cc | 14 + rtengine/improccoordinator.h | 3 + rtengine/rtengine.h | 4 + rtgui/editorpanel.cc | 10 +- rtgui/editorpanel.h | 1 + rtgui/histogrampanel.cc | 293 +++++++++++++----- rtgui/histogrampanel.h | 33 +- rtgui/options.cc | 13 +- rtgui/options.h | 3 +- 14 files changed, 791 insertions(+), 100 deletions(-) create mode 100644 rtdata/images/svg/histogram-type-histogram-off-small.svg create mode 100644 rtdata/images/svg/histogram-type-vectorscope-hc-off-small.svg create mode 100644 rtdata/images/svg/histogram-type-vectorscope-hs-off-small.svg create mode 100644 rtdata/images/svg/histogram-type-waveform-off-small.svg diff --git a/rtdata/images/svg/histogram-type-histogram-off-small.svg b/rtdata/images/svg/histogram-type-histogram-off-small.svg new file mode 100644 index 000000000..456ead7e2 --- /dev/null +++ b/rtdata/images/svg/histogram-type-histogram-off-small.svg @@ -0,0 +1,122 @@ + + + + + + + + + + image/svg+xml + + + + + Lawrence Lee + + + + + + + + RawTherapee icon. + + + + + + + + + + + + + + + + + + diff --git a/rtdata/images/svg/histogram-type-vectorscope-hc-off-small.svg b/rtdata/images/svg/histogram-type-vectorscope-hc-off-small.svg new file mode 100644 index 000000000..3a105a671 --- /dev/null +++ b/rtdata/images/svg/histogram-type-vectorscope-hc-off-small.svg @@ -0,0 +1,131 @@ + + + + + + + + + + image/svg+xml + + + + + Lawrence Lee + + + + + + + + RawTherapee icon. + + + + + + + + + + + + + + + + + + + + diff --git a/rtdata/images/svg/histogram-type-vectorscope-hs-off-small.svg b/rtdata/images/svg/histogram-type-vectorscope-hs-off-small.svg new file mode 100644 index 000000000..253d2d9c3 --- /dev/null +++ b/rtdata/images/svg/histogram-type-vectorscope-hs-off-small.svg @@ -0,0 +1,135 @@ + + + + + + + + + + image/svg+xml + + + + + Lawrence Lee + + + + + + + + RawTherapee icon. + + + + + + + + + + + + + + + + + + + + + diff --git a/rtdata/images/svg/histogram-type-waveform-off-small.svg b/rtdata/images/svg/histogram-type-waveform-off-small.svg new file mode 100644 index 000000000..787d6fe09 --- /dev/null +++ b/rtdata/images/svg/histogram-type-waveform-off-small.svg @@ -0,0 +1,122 @@ + + + + + + + + + + image/svg+xml + + + + + Lawrence Lee + + + + + + + + RawTherapee icon. + + + + + + + + + + + + + + + + + + diff --git a/rtdata/languages/default b/rtdata/languages/default index 1bcc1ab51..0ec86d367 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -249,7 +249,12 @@ HISTOGRAM_TOOLTIP_L;Show/Hide CIELab luminance histogram. HISTOGRAM_TOOLTIP_MODE;Toggle between linear, log-linear and log-log scaling of the histogram. HISTOGRAM_TOOLTIP_R;Show/Hide red histogram. HISTOGRAM_TOOLTIP_RAW;Show/Hide raw histogram. -HISTOGRAM_TOOLTIP_TYPE;Toggle between histogram, waveform, Hue-Saturation vectorscope, and Hue-Chroma vectorscope. +HISTOGRAM_TOOLTIP_TYPE;Toggle visibility of the scope selection buttons. +HISTOGRAM_TOOLTIP_TYPE_HISTOGRAM;Histogram +HISTOGRAM_TOOLTIP_TYPE_HISTOGRAM_RAW;Raw Histogram +HISTOGRAM_TOOLTIP_TYPE_WAVEFORM;Waveform +HISTOGRAM_TOOLTIP_TYPE_VECTORSCOPE_HC;Hue-Chroma Vectorscope +HISTOGRAM_TOOLTIP_TYPE_VECTORSCOPE_HS;Hue-Saturation Vectorscope HISTORY_CHANGED;Changed HISTORY_CUSTOMCURVE;Custom curve HISTORY_FROMCLIPBOARD;From clipboard diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index ea4c8a92b..f8d75b050 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -358,6 +358,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange) } imgsrc->getRAWHistogram(histRedRaw, histGreenRaw, histBlueRaw); + hist_raw_dirty = !hListener->updateHistogramRaw(); highDetailPreprocessComputed = highDetailNeeded; @@ -2471,6 +2472,19 @@ void ImProcCoordinator::requestUpdateHistogram() } } +void ImProcCoordinator::requestUpdateHistogramRaw() +{ + if (!hListener) { + return; + } + // Don't need to actually update histogram because it is always + // up-to-date. + if (hist_raw_dirty) { + hist_raw_dirty = false; + notifyHistogramChanged(); + } +} + void ImProcCoordinator::requestUpdateVectorscopeHC() { if (!hListener) { diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 791679678..d39fa3f9e 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -127,6 +127,8 @@ protected: LUTu histLuma, histToneCurve, histToneCurveBW, histLCurve, histCCurve; LUTu histLLCurve, histLCAM, histCCAM, histClad, bcabhist, histChroma, histLRETI; bool hist_lrgb_dirty; + /// Used to simulate a lazy update of the raw histogram. + bool hist_raw_dirty; int vectorscopeScale; bool vectorscope_hc_dirty, vectorscope_hs_dirty; array2D vectorscope_hc, vectorscope_hs; @@ -569,6 +571,7 @@ public: } denoiseInfoStore; void requestUpdateHistogram() override; + void requestUpdateHistogramRaw() override; void requestUpdateVectorscopeHC() override; void requestUpdateVectorscopeHS() override; void requestUpdateWaveform() override; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 43848e70c..6f6baccd4 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -346,6 +346,8 @@ public: virtual void setObservable(HistogramObservable* observable) = 0; /** Returns if the listener wants the histogram to be updated. */ virtual bool updateHistogram(void) const = 0; + /** Returns if the listener wants the raw histogram to be updated. */ + virtual bool updateHistogramRaw(void) const = 0; /** Returns if the listener wants the H-C vectorscope to be updated. */ virtual bool updateVectorscopeHC(void) const = 0; /** Returns if the listener wants the H-S vectorscope to be updated. */ @@ -359,6 +361,8 @@ class HistogramObservable public: /** Tells the observable to update the histogram data. */ virtual void requestUpdateHistogram() = 0; + /** Tells the observable to update the raw histogram data. */ + virtual void requestUpdateHistogramRaw() = 0; /** Tells the observable to update the H-C vectorscope data. */ virtual void requestUpdateVectorscopeHC() = 0; /** Tells the observable to update the H-S vectorscope data. */ diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index c53877736..205cf2bf2 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -2276,6 +2276,12 @@ bool EditorPanel::updateHistogram(void) const || histogram_scope_type == ScopeType::NONE; } +bool EditorPanel::updateHistogramRaw(void) const +{ + return histogram_scope_type == ScopeType::HISTOGRAM_RAW + || histogram_scope_type == ScopeType::NONE; +} + bool EditorPanel::updateVectorscopeHC(void) const { return @@ -2310,6 +2316,9 @@ void EditorPanel::scopeTypeChanged(ScopeType new_type) case ScopeType::HISTOGRAM: histogram_observable->requestUpdateHistogram(); break; + case ScopeType::HISTOGRAM_RAW: + histogram_observable->requestUpdateHistogramRaw(); + break; case ScopeType::VECTORSCOPE_HC: histogram_observable->requestUpdateVectorscopeHC(); break; @@ -2319,7 +2328,6 @@ void EditorPanel::scopeTypeChanged(ScopeType new_type) case ScopeType::WAVEFORM: histogram_observable->requestUpdateWaveform(); break; - case ScopeType::HISTOGRAM_RAW: case ScopeType::NONE: break; } diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index f6bc0b606..abfcb0a8f 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -145,6 +145,7 @@ public: ) override; void setObservable(rtengine::HistogramObservable* observable) override; bool updateHistogram(void) const override; + bool updateHistogramRaw(void) const override; bool updateVectorscopeHC(void) const override; bool updateVectorscopeHS(void) const override; bool updateWaveform(void) const override; diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index a9c8a95d6..449566007 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -80,6 +80,7 @@ HistogramPanel::HistogramPanel () : switch (options.histogramScopeType) { case ScopeType::NONE: + case ScopeType::HISTOGRAM_RAW: case ScopeType::VECTORSCOPE_HC: case ScopeType::VECTORSCOPE_HS: histogramRGBArea = nullptr; @@ -88,7 +89,6 @@ HistogramPanel::HistogramPanel () : histogramRGBArea = histogramRGBAreaVert.get(); break; case ScopeType::HISTOGRAM: - case ScopeType::HISTOGRAM_RAW: histogramRGBArea = histogramRGBAreaHori.get(); break; } @@ -113,7 +113,6 @@ HistogramPanel::HistogramPanel () : blueImage = new RTImage ("histogram-blue-on-small.png"); valueImage = new RTImage ("histogram-silver-on-small.png"); chroImage = new RTImage ("histogram-gold-on-small.png"); - rawImage = new RTImage ("histogram-bayer-on-small.png"); barImage = new RTImage ("histogram-bar-on-small.png"); redImage_g = new RTImage ("histogram-red-off-small.png"); @@ -121,7 +120,6 @@ HistogramPanel::HistogramPanel () : blueImage_g = new RTImage ("histogram-blue-off-small.png"); valueImage_g = new RTImage ("histogram-silver-off-small.png"); chroImage_g = new RTImage ("histogram-gold-off-small.png"); - rawImage_g = new RTImage ("histogram-bayer-off-small.png"); barImage_g = new RTImage ("histogram-bar-off-small.png"); mode0Image = new RTImage ("histogram-mode-linear-small.png"); @@ -129,20 +127,43 @@ HistogramPanel::HistogramPanel () : mode2Image = new RTImage ("histogram-mode-logxy-small.png"); histImage.reset(new RTImage("histogram-type-histogram-small.png")); + histRawImage.reset(new RTImage("histogram-bayer-on-small.png")); waveImage.reset(new RTImage("histogram-type-waveform-small.png")); vectHcImage.reset(new RTImage("histogram-type-vectorscope-hc-small.png")); vectHsImage.reset(new RTImage("histogram-type-vectorscope-hs-small.png")); + histImageOn.reset(new RTImage("histogram-type-histogram-small.png")); + histRawImageOn.reset(new RTImage("histogram-bayer-on-small.png")); + waveImageOn.reset(new RTImage("histogram-type-waveform-small.png")); + vectHcImageOn.reset(new RTImage("histogram-type-vectorscope-hc-small.png")); + vectHsImageOn.reset(new RTImage("histogram-type-vectorscope-hs-small.png")); + histImageOff.reset(new RTImage("histogram-type-histogram-off-small.png")); + histRawImageOff.reset(new RTImage("histogram-bayer-off-small.png")); + waveImageOff.reset(new RTImage("histogram-type-waveform-off-small.png")); + vectHcImageOff.reset(new RTImage("histogram-type-vectorscope-hc-off-small.png")); + vectHsImageOff.reset(new RTImage("histogram-type-vectorscope-hs-off-small.png")); + showRed = Gtk::manage (new Gtk::ToggleButton ()); showGreen = Gtk::manage (new Gtk::ToggleButton ()); showBlue = Gtk::manage (new Gtk::ToggleButton ()); showValue = Gtk::manage (new Gtk::ToggleButton ()); showChro = Gtk::manage (new Gtk::ToggleButton ()); - showRAW = Gtk::manage (new Gtk::ToggleButton ()); showMode = Gtk::manage (new Gtk::Button ()); - scopeType = Gtk::manage (new Gtk::Button ()); + scopeType = Gtk::manage (new Gtk::ToggleButton ()); showBAR = Gtk::manage (new Gtk::ToggleButton ()); + Gtk::RadioButtonGroup scopeTypeGroup; + scopeHistBtn = Gtk::manage(new Gtk::RadioButton(scopeTypeGroup)); + scopeHistRawBtn = Gtk::manage(new Gtk::RadioButton(scopeTypeGroup)); + scopeWaveBtn = Gtk::manage(new Gtk::RadioButton(scopeTypeGroup)); + scopeVectHcBtn = Gtk::manage(new Gtk::RadioButton(scopeTypeGroup)); + scopeVectHsBtn = Gtk::manage(new Gtk::RadioButton(scopeTypeGroup)); + scopeHistBtn->set_mode(false); + scopeHistRawBtn->set_mode(false); + scopeWaveBtn->set_mode(false); + scopeVectHcBtn->set_mode(false); + scopeVectHsBtn->set_mode(false); + showRed->set_name("histButton"); showRed->set_can_focus(false); showGreen->set_name("histButton"); @@ -153,44 +174,65 @@ HistogramPanel::HistogramPanel () : showValue->set_can_focus(false); showChro->set_name("histButton"); showChro->set_can_focus(false); - showRAW->set_name("histButton"); - showRAW->set_can_focus(false); showMode->set_name("histButton"); showMode->set_can_focus(false); scopeType->set_name("histButton"); scopeType->set_can_focus(false); showBAR->set_name("histButton"); showBAR->set_can_focus(false); + scopeHistBtn->set_name("histButton"); + scopeHistBtn->set_can_focus(false); + scopeHistRawBtn->set_name("histButton"); + scopeHistRawBtn->set_can_focus(false); + scopeWaveBtn->set_name("histButton"); + scopeWaveBtn->set_can_focus(false); + scopeVectHcBtn->set_name("histButton"); + scopeVectHcBtn->set_can_focus(false); + scopeVectHsBtn->set_name("histButton"); + scopeVectHsBtn->set_can_focus(false); showRed->set_relief (Gtk::RELIEF_NONE); showGreen->set_relief (Gtk::RELIEF_NONE); showBlue->set_relief (Gtk::RELIEF_NONE); showValue->set_relief (Gtk::RELIEF_NONE); showChro->set_relief (Gtk::RELIEF_NONE); - showRAW->set_relief (Gtk::RELIEF_NONE); showMode->set_relief (Gtk::RELIEF_NONE); scopeType->set_relief (Gtk::RELIEF_NONE); showBAR->set_relief (Gtk::RELIEF_NONE); + scopeHistBtn->set_relief (Gtk::RELIEF_NONE); + scopeHistRawBtn->set_relief (Gtk::RELIEF_NONE); + scopeWaveBtn->set_relief (Gtk::RELIEF_NONE); + scopeVectHcBtn->set_relief (Gtk::RELIEF_NONE); + scopeVectHsBtn->set_relief (Gtk::RELIEF_NONE); showRed->set_tooltip_text (M("HISTOGRAM_TOOLTIP_R")); showGreen->set_tooltip_text (M("HISTOGRAM_TOOLTIP_G")); showBlue->set_tooltip_text (M("HISTOGRAM_TOOLTIP_B")); showValue->set_tooltip_text (M("HISTOGRAM_TOOLTIP_L")); showChro->set_tooltip_text (M("HISTOGRAM_TOOLTIP_CHRO")); - showRAW->set_tooltip_text (M("HISTOGRAM_TOOLTIP_RAW")); showMode->set_tooltip_text (M("HISTOGRAM_TOOLTIP_MODE")); scopeType->set_tooltip_text (M("HISTOGRAM_TOOLTIP_TYPE")); showBAR->set_tooltip_text (M("HISTOGRAM_TOOLTIP_BAR")); + scopeHistBtn->set_tooltip_text(M("HISTOGRAM_TOOLTIP_TYPE_HISTOGRAM")); + scopeHistRawBtn->set_tooltip_text(M("HISTOGRAM_TOOLTIP_TYPE_HISTOGRAM_RAW")); + scopeWaveBtn->set_tooltip_text(M("HISTOGRAM_TOOLTIP_TYPE_WAVEFORM")); + scopeVectHcBtn->set_tooltip_text(M("HISTOGRAM_TOOLTIP_TYPE_VECTORSCOPE_HC")); + scopeVectHsBtn->set_tooltip_text(M("HISTOGRAM_TOOLTIP_TYPE_VECTORSCOPE_HS")); buttonGrid = Gtk::manage (new Gtk::Grid ()); - buttonGrid->set_orientation(Gtk::ORIENTATION_VERTICAL); + buttonGrid->set_orientation(Gtk::ORIENTATION_HORIZONTAL); + persistentButtons = Gtk::manage(new Gtk::Box()); + persistentButtons->set_orientation(Gtk::ORIENTATION_VERTICAL); + scopeButtons = Gtk::manage(new Gtk::Box()); + scopeButtons->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); // no showMode->set_active(), as it's not a ToggleButton + scopeType->set_active(options.histogramShowScopeButtons); showBAR->set_active (options.histogramBar); showRed->set_image (showRed->get_active() ? *redImage : *redImage_g); @@ -198,33 +240,43 @@ HistogramPanel::HistogramPanel () : showBlue->set_image (showBlue->get_active() ? *blueImage : *blueImage_g); showValue->set_image (showValue->get_active() ? *valueImage : *valueImage_g); showChro->set_image (showChro->get_active() ? *chroImage : *chroImage_g); - showRAW->set_image (showRAW->get_active() ? *rawImage : *rawImage_g); if (options.histogramDrawMode == 0) showMode->set_image(*mode0Image); else if (options.histogramDrawMode == 1) showMode->set_image(*mode1Image); else showMode->set_image(*mode2Image); + scopeHistBtn->set_image(*histImageOff); + scopeHistRawBtn->set_image(*histRawImageOff); + scopeWaveBtn->set_image(*waveImageOff); + scopeVectHcBtn->set_image(*vectHcImageOff); + scopeVectHsBtn->set_image(*vectHsImageOff); switch(options.histogramScopeType) { case ScopeType::HISTOGRAM: - scopeType->set_image(*histImage); - break; - case ScopeType::WAVEFORM: - scopeType->set_image(*waveImage); - break; - case ScopeType::VECTORSCOPE_HS: - scopeType->set_image(*vectHsImage); - break; - case ScopeType::VECTORSCOPE_HC: - scopeType->set_image(*vectHcImage); + scopeHistBtn->set_active(); + scopeHistBtn->set_image(*histImageOn); break; case ScopeType::HISTOGRAM_RAW: + scopeHistRawBtn->set_active(); + scopeHistRawBtn->set_image(*histRawImageOn); + break; + case ScopeType::WAVEFORM: + scopeWaveBtn->set_active(); + scopeWaveBtn->set_image(*waveImageOn); + break; + case ScopeType::VECTORSCOPE_HS: + scopeVectHsBtn->set_active(); + scopeVectHsBtn->set_image(*vectHsImageOn); + break; + case ScopeType::VECTORSCOPE_HC: + scopeVectHcBtn->set_active(); + scopeVectHcBtn->set_image(*vectHcImageOn); + break; case ScopeType::NONE: break; } showBAR->set_image (showBAR->get_active() ? *barImage : *barImage_g); - raw_toggled(); // Make sure the luma/chroma toggles are enabled or disabled type_changed(); setExpandAlignProperties(showRed , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); @@ -232,7 +284,6 @@ HistogramPanel::HistogramPanel () : setExpandAlignProperties(showBlue , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); setExpandAlignProperties(showValue, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); setExpandAlignProperties(showChro , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); - setExpandAlignProperties(showRAW , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); setExpandAlignProperties(showMode , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); setExpandAlignProperties(scopeType, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); setExpandAlignProperties(showBAR , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER); @@ -242,31 +293,48 @@ HistogramPanel::HistogramPanel () : showBlue->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::blue_toggled), showBlue ); showValue->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::value_toggled), showValue ); showChro->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::chro_toggled), showChro ); - showRAW->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::raw_toggled), showRAW ); showMode->signal_released().connect( sigc::mem_fun(*this, &HistogramPanel::mode_released), showMode ); - scopeType->signal_pressed().connect( sigc::mem_fun(*this, &HistogramPanel::type_pressed), scopeType ); + scopeType->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::type_pressed) ); showBAR->signal_toggled().connect( sigc::mem_fun(*this, &HistogramPanel::bar_toggled), showBAR ); + scopeHistBtn->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &HistogramPanel::type_selected), scopeHistBtn)); + scopeHistRawBtn->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &HistogramPanel::type_selected), scopeHistRawBtn)); + scopeWaveBtn->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &HistogramPanel::type_selected), scopeWaveBtn)); + scopeVectHcBtn->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &HistogramPanel::type_selected), scopeVectHcBtn)); + scopeVectHsBtn->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &HistogramPanel::type_selected), scopeVectHsBtn)); - buttonGrid->add (*showRed); - buttonGrid->add (*showGreen); - buttonGrid->add (*showBlue); - buttonGrid->add (*showValue); - buttonGrid->add (*showChro); - buttonGrid->add (*showRAW); - buttonGrid->add (*showMode); - buttonGrid->add (*scopeType); - buttonGrid->add (*showBAR); + persistentButtons->add(*showRed); + persistentButtons->add(*showGreen); + persistentButtons->add(*showBlue); + persistentButtons->add(*showValue); + persistentButtons->add(*showChro); + persistentButtons->add(*showMode); + persistentButtons->add(*scopeType); + persistentButtons->add(*showBAR); + + scopeButtons->add(*scopeHistBtn); + scopeButtons->add(*scopeHistRawBtn); + scopeButtons->add(*scopeWaveBtn); + scopeButtons->add(*scopeVectHsBtn); + scopeButtons->add(*scopeVectHcBtn); // Put the button vbox next to the window's border to be less disturbing if (options.histogramPosition == 1) { + buttonGrid->add(*persistentButtons); + buttonGrid->add(*scopeButtons); + add (*buttonGrid); add (*gfxGrid); } else { + buttonGrid->add(*scopeButtons); + buttonGrid->add(*persistentButtons); + add (*gfxGrid); add (*buttonGrid); } show_all (); + scopeButtons->set_no_show_all(); + scopeButtons->set_visible(options.histogramShowScopeButtons); rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &HistogramPanel::resized) ); } @@ -280,7 +348,6 @@ HistogramPanel::~HistogramPanel () delete blueImage; delete valueImage; delete chroImage; - delete rawImage; delete mode0Image; delete mode1Image; delete mode2Image; @@ -291,7 +358,6 @@ HistogramPanel::~HistogramPanel () delete blueImage_g; delete valueImage_g; delete chroImage_g; - delete rawImage_g; delete barImage_g; } @@ -369,24 +435,6 @@ void HistogramPanel::chro_toggled () rgbv_toggled(); } -void HistogramPanel::raw_toggled () -{ - if (showRAW->get_active()) { - showRAW->set_image(*rawImage); - showValue->set_sensitive(false); - showChro->set_sensitive(false); - } else { - showRAW->set_image(*rawImage_g); - showValue->set_sensitive( - options.histogramScopeType == ScopeType::HISTOGRAM - || options.histogramScopeType == ScopeType::WAVEFORM - ); - showChro->set_sensitive(options.histogramScopeType == ScopeType::HISTOGRAM); - } - - rgbv_toggled(); -} - void HistogramPanel::mode_released () { options.histogramDrawMode = (options.histogramDrawMode + 1) % 3; @@ -401,28 +449,72 @@ void HistogramPanel::mode_released () void HistogramPanel::type_pressed() { - // Switch to next type. + options.histogramShowScopeButtons = scopeType->get_active(); + scopeButtons->set_visible(scopeType->get_active()); +} + +void HistogramPanel::type_selected(Gtk::RadioButton* button) +{ + ScopeType new_type = ScopeType::NONE; + + if (button == scopeHistBtn) { + new_type = ScopeType::HISTOGRAM; + } else if (button == scopeHistRawBtn) { + new_type = ScopeType::HISTOGRAM_RAW; + } else if (button == scopeWaveBtn) { + new_type = ScopeType::WAVEFORM; + } else if (button == scopeVectHcBtn) { + new_type = ScopeType::VECTORSCOPE_HC; + } else if (button == scopeVectHsBtn) { + new_type = ScopeType::VECTORSCOPE_HS; + } + + if (new_type == options.histogramScopeType) { + return; + } + switch (options.histogramScopeType) { - case ScopeType::NONE: // Default to histogram. - case ScopeType::HISTOGRAM_RAW: // Not supported as a true scope type. - case ScopeType::VECTORSCOPE_HC: - options.histogramScopeType = ScopeType::HISTOGRAM; - scopeType->set_image(*histImage); - break; case ScopeType::HISTOGRAM: - options.histogramScopeType = ScopeType::WAVEFORM; - scopeType->set_image(*waveImage); + scopeHistBtn->set_image(*histImageOff); + break; + case ScopeType::HISTOGRAM_RAW: + scopeHistRawBtn->set_image(*histRawImageOff); break; case ScopeType::WAVEFORM: - options.histogramScopeType = ScopeType::VECTORSCOPE_HS; - scopeType->set_image(*vectHsImage); + scopeWaveBtn->set_image(*waveImageOff); + break; + case ScopeType::VECTORSCOPE_HC: + scopeVectHcBtn->set_image(*vectHcImageOff); break; case ScopeType::VECTORSCOPE_HS: - options.histogramScopeType = ScopeType::VECTORSCOPE_HC; - scopeType->set_image(*vectHcImage); + scopeVectHsBtn->set_image(*vectHsImageOff); + break; + case ScopeType::NONE: break; } + switch (new_type) { + case ScopeType::HISTOGRAM: + scopeHistBtn->set_image(*histImageOn); + break; + case ScopeType::HISTOGRAM_RAW: + scopeHistRawBtn->set_image(*histRawImageOn); + break; + case ScopeType::WAVEFORM: + scopeWaveBtn->set_image(*waveImageOn); + break; + case ScopeType::VECTORSCOPE_HC: + scopeVectHcBtn->set_image(*vectHcImageOn); + break; + case ScopeType::VECTORSCOPE_HS: + scopeVectHsBtn->set_image(*vectHsImageOn); + break; + case ScopeType::NONE: + break; + } + + options.histogramScopeType = new_type; + type_changed(); updateHistAreaOptions(); if (histogramRGBArea) { @@ -439,15 +531,24 @@ void HistogramPanel::type_changed() switch (options.histogramScopeType) { case ScopeType::HISTOGRAM: + showRed->set_sensitive(); + showGreen->set_sensitive(); + showBlue->set_sensitive(); + showValue->set_sensitive(); + showChro->set_sensitive(); + showMode->set_sensitive(); + scopeType->set_image(*histImage); + histogramRGBArea = histogramRGBAreaHori.get(); + break; case ScopeType::HISTOGRAM_RAW: showRed->set_sensitive(); showGreen->set_sensitive(); showBlue->set_sensitive(); - showValue->set_sensitive(!showRAW->get_active()); - showChro->set_sensitive(!showRAW->get_active()); - showRAW->set_sensitive(); + showValue->set_sensitive(false); + showChro->set_sensitive(false); showMode->set_sensitive(); - histogramRGBArea = histogramRGBAreaHori.get(); + scopeType->set_image(*histRawImage); + histogramRGBArea = nullptr; break; case ScopeType::WAVEFORM: showRed->set_sensitive(); @@ -455,8 +556,8 @@ void HistogramPanel::type_changed() showBlue->set_sensitive(); showValue->set_sensitive(); showChro->set_sensitive(false); - showRAW->set_sensitive(false); showMode->set_sensitive(false); + scopeType->set_image(*waveImage); histogramRGBArea = histogramRGBAreaVert.get(); break; case ScopeType::VECTORSCOPE_HC: @@ -466,8 +567,12 @@ void HistogramPanel::type_changed() showBlue->set_sensitive(false); showValue->set_sensitive(false); showChro->set_sensitive(false); - showRAW->set_sensitive(false); showMode->set_sensitive(false); + if (options.histogramScopeType == ScopeType::VECTORSCOPE_HC) { + scopeType->set_image(*vectHcImage); + } else { + scopeType->set_image(*vectHsImage); + } histogramRGBArea = nullptr; break; case ScopeType::NONE: @@ -533,11 +638,31 @@ void HistogramPanel::reorder (Gtk::PositionType align) removeIfThere(this, gfxGrid, false); add (*gfxGrid); gfxGrid->unreference(); + + if (histogramRGBArea == histogramRGBAreaVert.get()) { + gfxGrid->remove(*histogramRGBArea); + gfxGrid->add(*histogramRGBArea); + } + + scopeButtons->reference(); + removeIfThere(buttonGrid, scopeButtons, false); + buttonGrid->add(*scopeButtons); + scopeButtons->unreference(); } else { buttonGrid->reference(); removeIfThere(this, buttonGrid, false); add (*buttonGrid); buttonGrid->unreference(); + + if (histogramRGBArea == histogramRGBAreaVert.get()) { + gfxGrid->remove(*histogramArea); + gfxGrid->add(*histogramArea); + } + + persistentButtons->reference(); + removeIfThere(buttonGrid, persistentButtons, false); + buttonGrid->add(*persistentButtons); + persistentButtons->unreference(); } } @@ -569,7 +694,6 @@ void HistogramPanel::updateHistAreaOptions() showBlue->get_active(), showValue->get_active(), showChro->get_active(), - showRAW->get_active(), options.histogramDrawMode, options.histogramScopeType, showBAR->get_active() @@ -584,7 +708,6 @@ void HistogramPanel::updateHistRGBAreaOptions() showBlue->get_active(), showValue->get_active(), showChro->get_active(), - showRAW->get_active(), showBAR->get_active() ); } @@ -606,7 +729,7 @@ double HistogramScaling::log(double vsize, double val) 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), + needLuma(options.histogramLuma), needChroma(options.histogramChroma), showMode(options.histogramBar), barDisplayed(options.histogramBar), parent(nullptr) { get_style_context()->add_class("drawingarea"); @@ -679,8 +802,7 @@ void HistogramRGBArea::setShow(bool show) void HistogramRGBArea::updateBackBuffer (int r, int g, int b, const Glib::ustring &profile, const Glib::ustring &profileW) { - //if (!get_realized () || !showMode || (rawMode && options.histogramScopeType == ScopeType::HISTOGRAM) || options.histogramScopeType == ScopeType::HISTOGRAM_RAW) { - if (!get_realized () || !showMode || !((!rawMode && options.histogramScopeType == ScopeType::HISTOGRAM) || options.histogramScopeType == ScopeType::WAVEFORM)) { + if (!get_realized () || !showMode || !(options.histogramScopeType == ScopeType::HISTOGRAM || options.histogramScopeType == ScopeType::WAVEFORM)) { return; } @@ -791,7 +913,7 @@ void HistogramRGBArea::update (int valh, int rh, int gh, int bh) ); } -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 c, bool bar) { options.histogramRed = needRed = r; @@ -799,7 +921,6 @@ void HistogramRGBArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bo options.histogramBlue = needBlue = b; options.histogramLuma = needLuma = l; options.histogramChroma = needChroma = c; - options.histogramRAW = rawMode = raw; options.histogramBar = showMode = bar; } @@ -938,7 +1059,7 @@ HistogramArea::HistogramArea (DrawModeListener *fml) : oldwidth(-1), oldheight(-1), trace_brightness(1.0), needRed(options.histogramRed), needGreen(options.histogramGreen), needBlue(options.histogramBlue), - needLuma(options.histogramLuma), needChroma(options.histogramChroma), rawMode(options.histogramRAW), + needLuma(options.histogramLuma), needChroma(options.histogramChroma), isPressed(false), movingPosition(0.0), pointer_red(-1), pointer_green(-1), pointer_blue(-1) { @@ -1001,7 +1122,7 @@ 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, ScopeType type, bool pointer) +void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool c, int mode, ScopeType type, bool pointer) { options.histogramRed = needRed = r; @@ -1009,7 +1130,6 @@ void HistogramArea::updateOptions (bool r, bool g, bool b, bool l, bool c, bool options.histogramBlue = needBlue = b; options.histogramLuma = needLuma = l; options.histogramChroma = needChroma = c; - options.histogramRAW = rawMode = raw; options.histogramDrawMode = drawMode = mode; options.histogramScopeType = scopeType = type; options.histogramBar = needPointer = pointer; @@ -1049,6 +1169,8 @@ void HistogramArea::update( bhist = histBlue; lhist = histLuma; chist = histChroma; + break; + case ScopeType::HISTOGRAM_RAW: rhistRaw = histRedRaw; ghistRaw = histGreenRaw; bhistRaw = histBlueRaw; @@ -1071,7 +1193,6 @@ void HistogramArea::update( vect_hc = vectorscopeHC; vect_hc_buffer_dirty = true; break; - case ScopeType::HISTOGRAM_RAW: case ScopeType::NONE: break; } @@ -1187,6 +1308,8 @@ void HistogramArea::updateBackBuffer () cr->unset_dash(); if (valid && (scopeType == ScopeType::HISTOGRAM || scopeType == ScopeType::HISTOGRAM_RAW)) { + bool rawMode = scopeType == ScopeType::HISTOGRAM_RAW; + // For RAW mode use the other hists LUTu& rh = rawMode ? rhistRaw : rhist; LUTu& gh = rawMode ? ghistRaw : ghist; diff --git a/rtgui/histogrampanel.h b/rtgui/histogrampanel.h index 7167168ff..980a56f4f 100644 --- a/rtgui/histogrampanel.h +++ b/rtgui/histogrampanel.h @@ -80,7 +80,6 @@ protected: bool needBlue; bool needLuma; bool needChroma; - bool rawMode; bool showMode; bool barDisplayed; @@ -111,7 +110,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 c, bool show); void on_realize() override; bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) override; @@ -182,7 +181,6 @@ protected: float trace_brightness; bool needRed, needGreen, needBlue, needLuma, needChroma; - bool rawMode; bool isPressed; double movingPosition; bool needPointer; @@ -219,7 +217,7 @@ public: const array2D& waveformBlue, const array2D& waveformLuma ); - void updateOptions (bool r, bool g, bool b, bool l, bool c, bool raw, int mode, ScopeType type, bool pointer); + void updateOptions (bool r, bool g, bool b, bool l, bool c, int mode, ScopeType type, bool pointer); bool updatePending(); void on_realize() override; bool on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr) override; @@ -255,6 +253,8 @@ protected: Gtk::Grid* gfxGrid; Gtk::Grid* buttonGrid; + Gtk::Box* persistentButtons; + Gtk::Box* scopeButtons; HistogramArea* histogramArea; HistogramRGBArea* histogramRGBArea; std::unique_ptr histogramRGBAreaHori; @@ -263,17 +263,21 @@ protected: Gtk::ToggleButton* showGreen; Gtk::ToggleButton* showBlue; Gtk::ToggleButton* showValue; - Gtk::ToggleButton* showRAW; Gtk::ToggleButton* showBAR; Gtk::ToggleButton* showChro; Gtk::Button* showMode; - Gtk::Button* scopeType; + Gtk::ToggleButton* scopeType; + + Gtk::RadioButton* scopeHistBtn; + Gtk::RadioButton* scopeHistRawBtn; + Gtk::RadioButton* scopeWaveBtn; + Gtk::RadioButton* scopeVectHcBtn; + Gtk::RadioButton* scopeVectHsBtn; Gtk::Image *redImage; Gtk::Image *greenImage; Gtk::Image *blueImage; Gtk::Image *valueImage; - Gtk::Image *rawImage; Gtk::Image *barImage; Gtk::Image *chroImage; @@ -281,15 +285,26 @@ protected: Gtk::Image *greenImage_g; Gtk::Image *blueImage_g; Gtk::Image *valueImage_g; - Gtk::Image *rawImage_g; Gtk::Image *barImage_g; Gtk::Image *chroImage_g; std::unique_ptr histImage; + std::unique_ptr histRawImage; std::unique_ptr waveImage; std::unique_ptr vectHcImage; std::unique_ptr vectHsImage; + std::unique_ptr histImageOn; + std::unique_ptr histRawImageOn; + std::unique_ptr waveImageOn; + std::unique_ptr vectHcImageOn; + std::unique_ptr vectHsImageOn; + std::unique_ptr histImageOff; + std::unique_ptr histRawImageOff; + std::unique_ptr waveImageOff; + std::unique_ptr vectHcImageOff; + std::unique_ptr vectHsImageOff; + Gtk::Image *mode0Image; Gtk::Image *mode1Image; Gtk::Image *mode2Image; @@ -339,11 +354,11 @@ public: void green_toggled (); void blue_toggled (); void value_toggled (); - void raw_toggled (); void chro_toggled (); void bar_toggled (); void mode_released (); void type_pressed (); + void type_selected(Gtk::RadioButton* button); void type_changed (); void rgbv_toggled (); void resized (Gtk::Allocation& req); diff --git a/rtgui/options.cc b/rtgui/options.cc index 3e9c49e1e..06726452e 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -446,11 +446,11 @@ void Options::setDefaults() histogramBlue = true; histogramLuma = false; histogramChroma = false; - histogramRAW = false; histogramBar = true; histogramHeight = 200; histogramDrawMode = 0; histogramScopeType = ScopeType::HISTOGRAM; + histogramShowScopeButtons = false; curvebboxpos = 1; complexity = 2; prevdemo = PD_Sidecar; @@ -1418,7 +1418,10 @@ void Options::readFromFile(Glib::ustring fname) } if (keyFile.has_key("GUI", "HistogramRAW")) { - histogramRAW = keyFile.get_boolean("GUI", "HistogramRAW"); + // Legacy option, replaced by HistogramScopeType. + if (keyFile.get_boolean("GUI", "HistogramRAW")) { + histogramScopeType = ScopeType::HISTOGRAM_RAW; + } } if (keyFile.has_key("GUI", "HistogramBar")) { @@ -1437,6 +1440,10 @@ void Options::readFromFile(Glib::ustring fname) histogramScopeType = static_cast(keyFile.get_integer("GUI", "HistogramScopeType")); } + if (keyFile.has_key("GUI", "HistogramShowScopeButtons")) { + histogramShowScopeButtons = keyFile.get_boolean("GUI", "HistogramShowScopeButtons"); + } + if (keyFile.has_key("GUI", "NavigatorRGBUnit")) { navRGBUnit = (NavigatorUnit)keyFile.get_integer("GUI", "NavigatorRGBUnit"); } @@ -2256,11 +2263,11 @@ void Options::saveToFile(Glib::ustring fname) 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); keyFile.set_integer("GUI", "HistogramScopeType", histogramScopeType); + keyFile.set_boolean("GUI", "HistogramShowScopeButtons", histogramShowScopeButtons); keyFile.set_integer("GUI", "NavigatorRGBUnit", (int)navRGBUnit); keyFile.set_integer("GUI", "NavigatorHSVUnit", (int)navHSVUnit); keyFile.set_boolean("GUI", "ShowFilmStripToolBar", showFilmStripToolBar); diff --git a/rtgui/options.h b/rtgui/options.h index 19d394a05..4bc4ccc42 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -317,11 +317,12 @@ public: }; int histogramPosition; // 0=disabled, 1=left pane, 2=right pane bool histogramRed, histogramGreen, histogramBlue; - bool histogramLuma, histogramChroma, histogramRAW; + bool histogramLuma, histogramChroma; bool histogramBar; int histogramHeight; int histogramDrawMode; ScopeType histogramScopeType; + bool histogramShowScopeButtons; bool FileBrowserToolbarSingleRow; bool hideTPVScrollbar; int whiteBalanceSpotSize;