color meterbridge strips

This commit is contained in:
Robin Gareus 2013-07-24 11:59:40 +02:00 committed by Paul Davis
parent 74d6ce715a
commit 794ad61ff7
5 changed files with 68 additions and 17 deletions

View File

@ -989,3 +989,20 @@ style "default_toggle_button"
bg[ACTIVE] = @@COLPREFIX@_contrasting_indicator
fg[ACTIVE] = @@COLPREFIX@_darkest
}
style "meter_strip_dpm" = "default"
{
}
style "meter_strip_ppm" = "default"
{
bg[NORMAL] = { 0.1, 0.1, 0.1 }
fg[NORMAL] = { 1.0, 1.0, 1.0 }
}
style "meter_strip_vu" = "default"
{
bg[NORMAL] = { 1.0, 1.0, 0.85 }
fg[NORMAL] = { 0.0, 0.0, 0.0 }
}

View File

@ -290,6 +290,10 @@ widget "*PluginLoadButton" style:highest "small_button"
widget "*PluginLoadButton*" style:highest "small_button"
widget "*PluginEditorButton" style:highest "default_toggle_button"
widget "*meterstripPPM" style:highest "meter_strip_ppm"
widget "*meterstripDPM" style:highest "meter_strip_dpm"
widget "*meterstripVU" style:highest "meter_strip_vu"
widget "*MetricDialogFrame" style:highest "base_frame"
widget "*MetricEntry" style:highest "medium_bold_entry"
widget "*MetricButton" style:highest "default_button"

View File

@ -200,6 +200,7 @@ static inline float mtr_col_and_fract(
}
static void set_bg_color(Gtk::Widget& w, cairo_t* cr, MeterType type) {
// TODO use "meterstrip*" stype
switch(type) {
case MeterVU:
cairo_set_source_rgb (cr, 1.0, 1.0, 0.85);
@ -221,7 +222,8 @@ static void set_bg_color(Gtk::Widget& w, cairo_t* cr, MeterType type) {
}
}
static void set_fg_color(MeterType type, Gdk::Color * c) {
static void set_fg_color(Gtk::Widget& w, MeterType type, Gdk::Color * c) {
// TODO use "meterstrip*" stype
switch(type) {
case MeterVU:
c->set_rgb_p(0.0, 0.0, 0.0);
@ -270,7 +272,7 @@ meter_render_ticks (Gtk::Widget& w, MeterType type, vector<ARDOUR::DataType> typ
/* we're overlaying more than 1 set of marks, so use different colours */
c = w.get_style()->get_fg (Gtk::STATE_ACTIVE);
} else if (background) {
set_fg_color(type, &c);
set_fg_color(w, type, &c);
cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
} else {
c = w.get_style()->get_fg (Gtk::STATE_NORMAL);
@ -554,7 +556,7 @@ meter_render_metrics (Gtk::Widget& w, MeterType type, vector<DataType> types)
/* we're overlaying more than 1 set of marks, so use different colours */
c = w.get_style()->get_fg (Gtk::STATE_ACTIVE);
} else if (background) {
set_fg_color(type, &c);
set_fg_color(w, type, &c);
cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
} else {
c = w.get_style()->get_fg (Gtk::STATE_NORMAL);

View File

@ -64,7 +64,7 @@ MeterStrip::MeterStrip (int metricmode, MeterType mt)
{
level_meter = 0;
_strip_type = 0;
set_spacing(2);
strip.set_spacing(2);
peakbx.set_size_request(-1, 14);
namebx.set_size_request(18, 52);
@ -77,15 +77,17 @@ MeterStrip::MeterStrip (int metricmode, MeterType mt)
meterbox.pack_start(meter_metric_area, true, false);
pack_start (peakbx, false, false);
pack_start (meterbox, true, true);
pack_start (btnbox, false, false);
pack_start (namebx, false, false);
strip.pack_start (peakbx, false, false);
strip.pack_start (meterbox, true, true);
strip.pack_start (btnbox, false, false);
strip.pack_start (namebx, false, false);
add(strip);
peakbx.show();
btnbox.show();
meter_metric_area.show();
meterbox.show();
strip.show();
UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &MeterStrip::on_theme_changed));
ColorsChanged.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed));
@ -98,7 +100,7 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr<ARDOUR::Route> rt)
, _route(rt)
, peak_display()
{
set_spacing(2);
strip.set_spacing(2);
RouteUI::set_route (rt);
SessionHandlePtr::set_session (sess);
@ -174,11 +176,12 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr<ARDOUR::Route> rt)
update_button_box();
update_name_box();
update_background (_route->meter_type());
pack_start (peakbx, false, false);
pack_start (meterbox, true, true);
pack_start (btnbox, false, false);
pack_start (namebx, false, false);
strip.pack_start (peakbx, false, false);
strip.pack_start (meterbox, true, true);
strip.pack_start (btnbox, false, false);
strip.pack_start (namebx, false, false);
name_label.show();
peak_display.show();
peakbx.show();
@ -189,6 +192,8 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr<ARDOUR::Route> rt)
meter_align.show();
peak_align.show();
btnbox.show();
add(strip);
strip.show();
_route->shared_peak_meter()->ConfigurationChanged.connect (
route_connections, invalidator (*this), boost::bind (&MeterStrip::meter_configuration_changed, this, _1), gui_context()
@ -375,7 +380,7 @@ MeterStrip::meter_configuration_changed (ChanCount c)
void
MeterStrip::on_size_request (Gtk::Requisition* r)
{
VBox::on_size_request(r);
EventBox::on_size_request(r);
}
void
@ -390,7 +395,7 @@ MeterStrip::on_size_allocate (Gtk::Allocation& a)
name_label.set_size_request(18, nh-2);
name_label.layout()->set_width((nh-4) * PANGO_SCALE);
}
VBox::on_size_allocate(a);
EventBox::on_size_allocate(a);
}
gint
@ -427,10 +432,30 @@ MeterStrip::set_metric_mode (int metricmode, ARDOUR::MeterType mt)
_types.push_back (DataType::AUDIO);
break;
}
update_background (mt);
meter_metric_area.queue_draw ();
}
void
MeterStrip::update_background(MeterType type)
{
switch(type) {
case MeterIEC1DIN:
case MeterIEC1NOR:
case MeterIEC2BBC:
case MeterIEC2EBU:
case MeterK14:
case MeterK20:
set_name ("meterstripPPM");
break;
case MeterVU:
set_name ("meterstripVU");
break;
default:
set_name ("meterstripDPM");
}
}
MeterType
MeterStrip::meter_type()
{
@ -631,6 +656,7 @@ MeterStrip::meter_type_changed (MeterType type)
if (_route->meter_type() != type) {
_route->set_meter_type(type);
}
update_background (type);
MetricChanged();
}

View File

@ -43,7 +43,7 @@ namespace Gtk {
class Style;
}
class MeterStrip : public Gtk::VBox, public RouteUI
class MeterStrip : public Gtk::EventBox, public RouteUI
{
public:
MeterStrip (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>);
@ -90,6 +90,7 @@ class MeterStrip : public Gtk::VBox, public RouteUI
void set_button_names ();
private:
Gtk::VBox strip;
Gtk::HBox meterbox;
Gtk::HBox namebx;
ArdourButton name_label;
@ -120,6 +121,7 @@ class MeterStrip : public Gtk::VBox, public RouteUI
void strip_property_changed (const PBD::PropertyChange&);
void meter_configuration_changed (ARDOUR::ChanCount);
void meter_type_changed (ARDOUR::MeterType);
void update_background (ARDOUR::MeterType);
static int max_pattern_metric_size; // == FastMeter::max_pattern_metric_size