[Summary] According PRD change colour of numeric peak indicator background depend on its value. Do not change numeric peak indicator button on its click (when reset) (Igor Maximenko's request).

[Feature reviewed] Igor Maximenko, MKosharnyy
[Reviewed] VKamyshniy
This commit is contained in:
Nikolay 2015-04-27 18:30:07 +03:00
parent c7656d43bf
commit 5ab6bbe6e1
7 changed files with 52 additions and 14 deletions

View file

@ -24,6 +24,7 @@
#include "ardour/session_route.h"
#include "ardour/dB.h"
#include "ardour/utils.h"
#include "ardour/rc_configuration.h"
#include <pangomm.h>
#include <gtkmm/style.h>
@ -72,6 +73,9 @@ GainMeter::GainMeter (Session* s, const std::string& layout_script_file)
, gain_display_entry (get_entry ("gain_display_entry"))
, gain_display_button (get_waves_button ("gain_display_button"))
, peak_display_button (get_waves_button ("peak_display_button"))
, _peak_level_1_color (Gdk::Color(xml_property (*xml_tree ()->root (), "peak_level_1_color", "#ff0000")))
, _peak_level_2_color (Gdk::Color(xml_property (*xml_tree ()->root (), "peak_level_2_color", "#ffff00")))
, _peak_level_3_color (Gdk::Color(xml_property (*xml_tree ()->root (), "peak_level_3_color", "#262626")))
, level_meter_home (get_box ("level_meter_home"))
, level_meter (_session)
, _data_type (DataType::AUDIO)
@ -339,7 +343,8 @@ GainMeter::reset_peak_display ()
level_meter.clear_meters();
max_peak = -INFINITY;
peak_display_button.set_text (_("-inf"));
peak_display_button.set_active_state(Gtkmm2ext::Off);
peak_display_button.modify_bg(Gtk::STATE_NORMAL, _peak_level_3_color);
peak_display_button.modify_bg(Gtk::STATE_ACTIVE, _peak_level_3_color);
}
void
@ -916,6 +921,12 @@ GainMeter::_astyle_string (AutoStyle style, bool shrt)
}
}
namespace {
float round_to_tenths (float value) {
return (float)((int)(value*10))/10;
}
}
void
GainMeter::update_meters()
{
@ -926,15 +937,26 @@ GainMeter::update_meters()
max_peak = mpeak;
if (mpeak <= Config->get_numeric_peak_min_treshold()) {
peak_display_button.set_text (_("-inf"));
peak_display_button.modify_bg(Gtk::STATE_NORMAL, _peak_level_3_color);
peak_display_button.modify_bg(Gtk::STATE_ACTIVE, _peak_level_3_color);
} else {
mpeak = round_to_tenths (mpeak);
snprintf (buf, sizeof(buf), "%.1f", mpeak);
peak_display_button.set_text (buf);
Gdk::Color color;
if (mpeak <= Config->get_meter_peak_2()) {
color = _peak_level_3_color;
} else if (mpeak < Config->get_meter_peak()) {
color = _peak_level_2_color;
} else {
color = _peak_level_1_color;
}
peak_display_button.modify_bg(Gtk::STATE_NORMAL, color);
peak_display_button.modify_bg(Gtk::STATE_ACTIVE, color);
}
}
if (mpeak >= Config->get_meter_peak()) {
//peak_display_button.set_name ("MixerStripPeakDisplayPeak");
peak_display_button.set_active_state(Gtkmm2ext::ExplicitActive);
}
}
void GainMeter::color_handler(bool /*dpi*/)

View file

@ -123,6 +123,9 @@ class GainMeter : virtual public sigc::trackable, ARDOUR::SessionHandlePtr, publ
Gtk::Entry& gain_display_entry;
WavesButton& gain_display_button;
WavesButton& peak_display_button;
Gdk::Color _peak_level_1_color;
Gdk::Color _peak_level_2_color;
Gdk::Color _peak_level_3_color;
Gtk::Box& level_meter_home;
LevelMeterHBox level_meter;

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<GainSlider meterwidth="6"
thinmeterwidth="6">
thinmeterwidth="6"
peak_level_1_color="#FE0E0E"
peak_level_2_color="#FEFE0E"
peak_level_3_color="#262626">
<Adjustment id="gain_adjustment"
minvalue="0"
maxvalue="1"
@ -16,9 +19,9 @@
winfont="Arial Bold 12"
macfont="Helvetica Bold 12"
bgnormal="#262626"
bgactive="#FE0E0E"
fgnormal="#afafaf"
fgactive="#afafaf"
bgactive="#262626"
fgnormal="#AFAFAF"
fgactive="#AFAFAF"
bghover="#C47474"
bordercolor="#FFFFFF33"
borderwidth="0 0 0 0"/>

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<GainSlider meterwidth="10"
thinmeterwidth="5">
thinmeterwidth="5"
peak_level_1_color="#FE0E0E"
peak_level_2_color="#FEFE0E"
peak_level_3_color="#262626">
<Adjustment id="gain_adjustment"
minvalue="0"
maxvalue="1"/>
@ -11,7 +14,7 @@
winfont="Arial Bold 9"
macfont="Helvetica Bold 9"
bgnormal="#262626"
bgactive="#FE0E0E"
bgactive="#262626"
fgnormal="#afafaf"
fgactive="#afafaf"
bghover="#C47474"/>

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<GainSlider meterwidth="6"
thinmeterwidth="6">
thinmeterwidth="6"
peak_level_1_color="#FE0E0E"
peak_level_2_color="#FEFE0E"
peak_level_3_color="#262626">
<Adjustment id="gain_adjustment"
minvalue="0"
maxvalue="1"
@ -11,7 +14,7 @@
winfont="Arial Bold 9"
macfont="Helvetica Bold 9"
bgnormal="#262626"
bgactive="#FE0E0E"
bgactive="#262626"
fgnormal="#afafaf"
fgactive="#afafaf"
bghover="#C47474"

View file

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<GainSlider meterwidth="7"
thinmeterwidth="3">
thinmeterwidth="3"
peak_level_1_color="#FE0E0E"
peak_level_2_color="#FEFE0E"
peak_level_3_color="#262626">
<Adjustment id="gain_adjustment"
minvalue="0"
maxvalue="1"/>

View file

@ -171,6 +171,7 @@ CONFIG_VARIABLE (VUMeterStandard, meter_vu_standard, "meter-vu-standard", Meteri
CONFIG_VARIABLE (MeterLineUp, meter_line_up_level, "meter-line-up-level", MeteringLineUp18)
CONFIG_VARIABLE (MeterLineUp, meter_line_up_din, "meter-line-up-din", MeteringLineUp15)
CONFIG_VARIABLE (float, meter_peak, "meter-peak", 0.0f)
CONFIG_VARIABLE (float, meter_peak_2, "meter_peak_2", -6.0f)
CONFIG_VARIABLE (float, numeric_peak_min_treshold, "numeric-peak-min-treshold", -144.4f)
CONFIG_VARIABLE (bool, meter_style_led, "meter-style-led", true)
CONFIG_VARIABLE (bool, show_editor_meter, "show-editor-meter", true)