Add slider for adjusting scope trace brightness
This makes it easier for users to discover the feature and see the current brightness.
This commit is contained in:
parent
992a5ad3d9
commit
e93c4f6ed4
@ -251,6 +251,7 @@ HISTOGRAM_TOOLTIP_MODE;Toggle between linear, log-linear and log-log scaling of
|
|||||||
HISTOGRAM_TOOLTIP_R;Show/Hide red histogram.
|
HISTOGRAM_TOOLTIP_R;Show/Hide red histogram.
|
||||||
HISTOGRAM_TOOLTIP_RAW;Show/Hide raw histogram.
|
HISTOGRAM_TOOLTIP_RAW;Show/Hide raw histogram.
|
||||||
HISTOGRAM_TOOLTIP_SHOW_OPTIONS;Toggle visibility of the scope option buttons.
|
HISTOGRAM_TOOLTIP_SHOW_OPTIONS;Toggle visibility of the scope option buttons.
|
||||||
|
HISTOGRAM_TOOLTIP_TRACE_BRIGHTNESS;Adjust scope brightness.
|
||||||
HISTOGRAM_TOOLTIP_TYPE_HISTOGRAM;Histogram
|
HISTOGRAM_TOOLTIP_TYPE_HISTOGRAM;Histogram
|
||||||
HISTOGRAM_TOOLTIP_TYPE_HISTOGRAM_RAW;Raw Histogram
|
HISTOGRAM_TOOLTIP_TYPE_HISTOGRAM_RAW;Raw Histogram
|
||||||
HISTOGRAM_TOOLTIP_TYPE_PARADE;RGB Parade
|
HISTOGRAM_TOOLTIP_TYPE_PARADE;RGB Parade
|
||||||
|
@ -720,6 +720,23 @@ flowboxchild:selected {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Vertical version of slider. */
|
||||||
|
#histScale {
|
||||||
|
min-height: 4em;
|
||||||
|
min-width: 0.4166666666666666em;
|
||||||
|
margin: 0.5833333333333333em 0 0 0;
|
||||||
|
}
|
||||||
|
#histScale trough {
|
||||||
|
padding: 0.583333333333333333em 0;
|
||||||
|
}
|
||||||
|
#histScale trough highlight {
|
||||||
|
margin: -0.583333333333333333em 0;
|
||||||
|
padding: 0.1em 0 0 0.1em;
|
||||||
|
}
|
||||||
|
#histScale.fine-tune trough highlight {
|
||||||
|
padding: 0.5em 0 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
/* Copied from button.flat style. */
|
/* Copied from button.flat style. */
|
||||||
button.radio#histButton {
|
button.radio#histButton {
|
||||||
background-image: none;
|
background-image: none;
|
||||||
|
@ -453,6 +453,27 @@ filechooser placessidebar list row:selected {
|
|||||||
padding-bottom: 0.25em;
|
padding-bottom: 0.25em;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Vertical version of slider. */
|
||||||
|
#histScale {
|
||||||
|
min-height: 4em;
|
||||||
|
min-width: 1.833333333333333333em;
|
||||||
|
margin: -0.333333333333333333em 0;
|
||||||
|
}
|
||||||
|
#histScale trough {
|
||||||
|
padding: 0.583333333333333333em 0;
|
||||||
|
}
|
||||||
|
#histScale highlight {
|
||||||
|
background-image: linear-gradient(to right, shade (@accent-color2,1.22), shade(@accent-color2,.88));
|
||||||
|
margin: -0.583333333333333333em 0;
|
||||||
|
padding: 0.333333333333333333em 0 0 0.333333333333333333em;
|
||||||
|
}
|
||||||
|
#histScale slider {
|
||||||
|
}
|
||||||
|
#histScale.fine-tune highlight {
|
||||||
|
padding: 0.5em 0 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
/* Copied from button.flat style. */
|
/* Copied from button.flat style. */
|
||||||
button.radio#histButton {
|
button.radio#histButton {
|
||||||
border: 0.083333333333333333em solid transparent;
|
border: 0.083333333333333333em solid transparent;
|
||||||
|
@ -273,14 +273,14 @@ HistogramPanel::HistogramPanel () :
|
|||||||
scopeOptions->set_image(*Gtk::manage(new RTImage("histogram-ellipsis-small.png")));
|
scopeOptions->set_image(*Gtk::manage(new RTImage("histogram-ellipsis-small.png")));
|
||||||
showBAR->set_image (showBAR->get_active() ? *barImage : *barImage_g);
|
showBAR->set_image (showBAR->get_active() ? *barImage : *barImage_g);
|
||||||
|
|
||||||
setExpandAlignProperties(showRed , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(showRed , false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||||
setExpandAlignProperties(showGreen, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(showGreen, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||||
setExpandAlignProperties(showBlue , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(showBlue , false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||||
setExpandAlignProperties(showValue, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(showValue, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||||
setExpandAlignProperties(showChro , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(showChro , false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||||
setExpandAlignProperties(showMode , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(showMode , false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||||
setExpandAlignProperties(scopeOptions, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(scopeOptions, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
||||||
setExpandAlignProperties(showBAR , false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(showBAR , false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||||
setExpandAlignProperties(scopeOptions, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
setExpandAlignProperties(scopeOptions, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
||||||
setExpandAlignProperties(scopeHistBtn, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
setExpandAlignProperties(scopeHistBtn, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
||||||
setExpandAlignProperties(scopeHistRawBtn, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
setExpandAlignProperties(scopeHistRawBtn, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
|
||||||
@ -306,6 +306,15 @@ HistogramPanel::HistogramPanel () :
|
|||||||
scopeVectHcBtn->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &HistogramPanel::type_selected), scopeVectHcBtn));
|
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));
|
scopeVectHsBtn->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &HistogramPanel::type_selected), scopeVectHsBtn));
|
||||||
|
|
||||||
|
brightnessWidget = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_VERTICAL));
|
||||||
|
brightnessWidget->set_inverted();
|
||||||
|
brightnessWidget->set_range(log(HistogramArea::MIN_BRIGHT), log(HistogramArea::MAX_BRIGHT));
|
||||||
|
brightnessWidget->set_draw_value(false);
|
||||||
|
brightnessWidget->signal_value_changed().connect(sigc::mem_fun(*this, &HistogramPanel::brightnessWidgetValueChanged));
|
||||||
|
brightnessWidget->set_name("histScale");
|
||||||
|
brightnessWidget->set_tooltip_text(M("HISTOGRAM_TOOLTIP_TRACE_BRIGHTNESS"));
|
||||||
|
setExpandAlignProperties(brightnessWidget, true, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_START);
|
||||||
|
|
||||||
optionButtons->add(*showRed);
|
optionButtons->add(*showRed);
|
||||||
optionButtons->add(*showGreen);
|
optionButtons->add(*showGreen);
|
||||||
optionButtons->add(*showBlue);
|
optionButtons->add(*showBlue);
|
||||||
@ -313,6 +322,7 @@ HistogramPanel::HistogramPanel () :
|
|||||||
optionButtons->add(*showChro);
|
optionButtons->add(*showChro);
|
||||||
optionButtons->add(*showMode);
|
optionButtons->add(*showMode);
|
||||||
optionButtons->add(*showBAR);
|
optionButtons->add(*showBAR);
|
||||||
|
optionButtons->add(*brightnessWidget);
|
||||||
|
|
||||||
Gtk::VSeparator* separator = Gtk::manage(new Gtk::VSeparator());
|
Gtk::VSeparator* separator = Gtk::manage(new Gtk::VSeparator());
|
||||||
setExpandAlignProperties(separator, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
|
setExpandAlignProperties(separator, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
|
||||||
@ -350,6 +360,7 @@ HistogramPanel::HistogramPanel () :
|
|||||||
updateHistRGBAreaOptions();
|
updateHistRGBAreaOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
brightness_changed_connection = histogramArea->getBrighnessChangedSignal().connect(sigc::mem_fun(*this, &HistogramPanel::brightnessUpdated));
|
||||||
rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &HistogramPanel::resized) );
|
rconn = signal_size_allocate().connect( sigc::mem_fun(*this, &HistogramPanel::resized) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,6 +472,17 @@ void HistogramPanel::mode_released ()
|
|||||||
rgbv_toggled();
|
rgbv_toggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistogramPanel::brightnessWidgetValueChanged(void)
|
||||||
|
{
|
||||||
|
ConnectionBlocker blocker(brightness_changed_connection);
|
||||||
|
histogramArea->setBrightness(exp(brightnessWidget->get_value()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistogramPanel::brightnessUpdated(float brightness)
|
||||||
|
{
|
||||||
|
brightnessWidget->set_value(log(brightness));
|
||||||
|
}
|
||||||
|
|
||||||
void HistogramPanel::scopeOptionsToggled()
|
void HistogramPanel::scopeOptionsToggled()
|
||||||
{
|
{
|
||||||
options.histogramShowOptionButtons = scopeOptions->get_active();
|
options.histogramShowOptionButtons = scopeOptions->get_active();
|
||||||
@ -512,6 +534,7 @@ void HistogramPanel::type_changed()
|
|||||||
showMode->show();
|
showMode->show();
|
||||||
showBAR->show();
|
showBAR->show();
|
||||||
showBAR->set_tooltip_text(M("HISTOGRAM_TOOLTIP_BAR"));
|
showBAR->set_tooltip_text(M("HISTOGRAM_TOOLTIP_BAR"));
|
||||||
|
brightnessWidget->hide();
|
||||||
histogramRGBArea = histogramRGBAreaHori.get();
|
histogramRGBArea = histogramRGBAreaHori.get();
|
||||||
break;
|
break;
|
||||||
case ScopeType::HISTOGRAM_RAW:
|
case ScopeType::HISTOGRAM_RAW:
|
||||||
@ -522,6 +545,7 @@ void HistogramPanel::type_changed()
|
|||||||
showChro->hide();
|
showChro->hide();
|
||||||
showMode->show();
|
showMode->show();
|
||||||
showBAR->hide();
|
showBAR->hide();
|
||||||
|
brightnessWidget->hide();
|
||||||
histogramRGBArea = nullptr;
|
histogramRGBArea = nullptr;
|
||||||
break;
|
break;
|
||||||
case ScopeType::PARADE:
|
case ScopeType::PARADE:
|
||||||
@ -534,6 +558,7 @@ void HistogramPanel::type_changed()
|
|||||||
showMode->hide();
|
showMode->hide();
|
||||||
showBAR->show();
|
showBAR->show();
|
||||||
showBAR->set_tooltip_text(M("HISTOGRAM_TOOLTIP_BAR"));
|
showBAR->set_tooltip_text(M("HISTOGRAM_TOOLTIP_BAR"));
|
||||||
|
brightnessWidget->show();
|
||||||
histogramRGBArea = histogramRGBAreaVert.get();
|
histogramRGBArea = histogramRGBAreaVert.get();
|
||||||
break;
|
break;
|
||||||
case ScopeType::VECTORSCOPE_HC:
|
case ScopeType::VECTORSCOPE_HC:
|
||||||
@ -546,6 +571,7 @@ void HistogramPanel::type_changed()
|
|||||||
showMode->hide();
|
showMode->hide();
|
||||||
showBAR->show();
|
showBAR->show();
|
||||||
showBAR->set_tooltip_text(M("HISTOGRAM_TOOLTIP_CROSSHAIR"));
|
showBAR->set_tooltip_text(M("HISTOGRAM_TOOLTIP_CROSSHAIR"));
|
||||||
|
brightnessWidget->show();
|
||||||
histogramRGBArea = nullptr;
|
histogramRGBArea = nullptr;
|
||||||
break;
|
break;
|
||||||
case ScopeType::NONE:
|
case ScopeType::NONE:
|
||||||
@ -1921,23 +1947,39 @@ bool HistogramArea::on_motion_notify_event (GdkEventMotion* event)
|
|||||||
|| scopeType == ScopeType::VECTORSCOPE_HC
|
|| scopeType == ScopeType::VECTORSCOPE_HC
|
||||||
|| scopeType == ScopeType::VECTORSCOPE_HS
|
|| scopeType == ScopeType::VECTORSCOPE_HS
|
||||||
) { // Adjust brightness.
|
) { // Adjust brightness.
|
||||||
constexpr float MIN_BRIGHT = 0.1;
|
|
||||||
constexpr float MAX_BRIGHT = 3;
|
|
||||||
constexpr float RANGE = MAX_BRIGHT / MIN_BRIGHT;
|
constexpr float RANGE = MAX_BRIGHT / MIN_BRIGHT;
|
||||||
double dx = (event->x - movingPosition) / get_width();
|
double dx = (event->x - movingPosition) / get_width();
|
||||||
float new_brightness = LIM<float>(trace_brightness * pow(RANGE, dx), MIN_BRIGHT, MAX_BRIGHT);
|
float new_brightness = LIM<float>(trace_brightness * pow(RANGE, dx), MIN_BRIGHT, MAX_BRIGHT);
|
||||||
if (new_brightness != trace_brightness) {
|
setBrightness(new_brightness);
|
||||||
parade_buffer_r_dirty = parade_buffer_g_dirty = parade_buffer_b_dirty = wave_buffer_dirty = wave_buffer_luma_dirty = vect_hc_buffer_dirty = vect_hs_buffer_dirty = true;
|
|
||||||
trace_brightness = new_brightness;
|
|
||||||
setDirty(true);
|
|
||||||
queue_draw();
|
|
||||||
}
|
|
||||||
movingPosition = event->x;
|
movingPosition = event->x;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float HistogramArea::getBrightness(void)
|
||||||
|
{
|
||||||
|
return trace_brightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistogramArea::setBrightness(float brightness)
|
||||||
|
{
|
||||||
|
brightness = LIM<float>(brightness, MIN_BRIGHT, MAX_BRIGHT);
|
||||||
|
if (brightness != trace_brightness) {
|
||||||
|
parade_buffer_r_dirty = parade_buffer_g_dirty = parade_buffer_b_dirty = wave_buffer_dirty = wave_buffer_luma_dirty = vect_hc_buffer_dirty = vect_hs_buffer_dirty = true;
|
||||||
|
trace_brightness = brightness;
|
||||||
|
setDirty(true);
|
||||||
|
queue_draw();
|
||||||
|
|
||||||
|
signal_brightness_changed.emit(trace_brightness);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HistogramArea::SignalBrightnessChanged HistogramArea::getBrighnessChangedSignal(void)
|
||||||
|
{
|
||||||
|
return signal_brightness_changed;
|
||||||
|
}
|
||||||
|
|
||||||
HistogramArea::type_signal_factor_changed HistogramArea::signal_factor_changed()
|
HistogramArea::type_signal_factor_changed HistogramArea::signal_factor_changed()
|
||||||
{
|
{
|
||||||
return sigFactorChanged;
|
return sigFactorChanged;
|
||||||
|
@ -152,7 +152,10 @@ class HistogramArea final : public Gtk::DrawingArea, public BackBuffer, private
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef sigc::signal<void, double> type_signal_factor_changed;
|
typedef sigc::signal<void, double> type_signal_factor_changed;
|
||||||
|
typedef sigc::signal<void, float> SignalBrightnessChanged;
|
||||||
|
|
||||||
|
static constexpr float MIN_BRIGHT = 0.1;
|
||||||
|
static constexpr float MAX_BRIGHT = 3;
|
||||||
private:
|
private:
|
||||||
IdleRegister idle_register;
|
IdleRegister idle_register;
|
||||||
type_signal_factor_changed sigFactorChanged;
|
type_signal_factor_changed sigFactorChanged;
|
||||||
@ -194,6 +197,8 @@ protected:
|
|||||||
int pointer_red, pointer_green, pointer_blue;
|
int pointer_red, pointer_green, pointer_blue;
|
||||||
float pointer_a, pointer_b;
|
float pointer_a, pointer_b;
|
||||||
|
|
||||||
|
SignalBrightnessChanged signal_brightness_changed;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit HistogramArea(DrawModeListener *fml = nullptr);
|
explicit HistogramArea(DrawModeListener *fml = nullptr);
|
||||||
~HistogramArea() override;
|
~HistogramArea() override;
|
||||||
@ -226,6 +231,10 @@ public:
|
|||||||
bool on_button_press_event (GdkEventButton* event) override;
|
bool on_button_press_event (GdkEventButton* event) override;
|
||||||
bool on_button_release_event (GdkEventButton* event) override;
|
bool on_button_release_event (GdkEventButton* event) override;
|
||||||
bool on_motion_notify_event (GdkEventMotion* event) override;
|
bool on_motion_notify_event (GdkEventMotion* event) override;
|
||||||
|
float getBrightness(void);
|
||||||
|
/** Set the trace brightness, with 1 being normal. */
|
||||||
|
void setBrightness(float brightness);
|
||||||
|
SignalBrightnessChanged getBrighnessChangedSignal(void);
|
||||||
type_signal_factor_changed signal_factor_changed();
|
type_signal_factor_changed signal_factor_changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -270,6 +279,7 @@ protected:
|
|||||||
Gtk::ToggleButton* showChro;
|
Gtk::ToggleButton* showChro;
|
||||||
Gtk::Button* showMode;
|
Gtk::Button* showMode;
|
||||||
Gtk::ToggleButton* scopeOptions;
|
Gtk::ToggleButton* scopeOptions;
|
||||||
|
Gtk::Scale* brightnessWidget;
|
||||||
|
|
||||||
Gtk::RadioButton* scopeHistBtn;
|
Gtk::RadioButton* scopeHistBtn;
|
||||||
Gtk::RadioButton* scopeHistRawBtn;
|
Gtk::RadioButton* scopeHistRawBtn;
|
||||||
@ -298,6 +308,7 @@ protected:
|
|||||||
|
|
||||||
HistogramPanelListener* panel_listener;
|
HistogramPanelListener* panel_listener;
|
||||||
|
|
||||||
|
sigc::connection brightness_changed_connection;
|
||||||
sigc::connection rconn;
|
sigc::connection rconn;
|
||||||
void setHistInvalid ();
|
void setHistInvalid ();
|
||||||
void showRGBBar();
|
void showRGBBar();
|
||||||
@ -344,6 +355,8 @@ public:
|
|||||||
void chro_toggled ();
|
void chro_toggled ();
|
||||||
void bar_toggled ();
|
void bar_toggled ();
|
||||||
void mode_released ();
|
void mode_released ();
|
||||||
|
void brightnessWidgetValueChanged();
|
||||||
|
void brightnessUpdated(float brightness);
|
||||||
void scopeOptionsToggled();
|
void scopeOptionsToggled();
|
||||||
void type_selected(Gtk::RadioButton* button);
|
void type_selected(Gtk::RadioButton* button);
|
||||||
void type_changed ();
|
void type_changed ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user