using namespace Gtk;
using namespace Gtkmm2ext;
using namespace std;
+using namespace ArdourMeter;
PBD::Signal1<void,MeterStrip*> MeterStrip::CatchDeletion;
PBD::Signal0<void> MeterStrip::MetricChanged;
, RouteUI(0)
{
level_meter = 0;
+ _strip_type = 0;
set_spacing(2);
peakbx.set_size_request(-1, 14);
- btnbox.set_size_request(-1, 16);
namebx.set_size_request(18, 52);
set_metric_mode(metricmode);
- set_size_request_to_display_given_text (meter_metric_area, "-8888", 1, 0);
+ meter_metric_area.set_size_request(25, 10);
meter_metric_area.signal_expose_event().connect (
sigc::mem_fun(*this, &MeterStrip::meter_metrics_expose));
RedrawMetrics.connect (sigc::mem_fun(*this, &MeterStrip::redraw_metrics));
btnbox.show();
meter_metric_area.show();
meterbox.show();
- namebx.show();
UI::instance()->theme_changed.connect (sigc::mem_fun(*this, &MeterStrip::on_theme_changed));
ColorsChanged.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed));
{
set_spacing(2);
RouteUI::set_route (rt);
+ SessionHandlePtr::set_session (sess);
_has_midi = false;
peakbx.set_size_request(-1, 14);
// add track-name label
- name_label.set_text(_route->name().c_str());
+ name_label.set_text(_route->name());
name_label.set_corner_radius(2);
name_label.set_name("meterbridge label");
name_label.set_angle(-90.0);
name_label.layout()->set_width(48 * PANGO_SCALE);
name_label.set_size_request(18, 50);
name_label.set_alignment(-1.0, .5);
+ ARDOUR_UI::instance()->set_tip (name_label, _route->name());
namebx.set_size_request(18, 52);
namebx.pack_start(name_label, true, false, 3);
- // rec-enable button
- btnbox.pack_start(*rec_enable_button, true, false);
+ recbox.pack_start(*rec_enable_button, true, false);
+ btnbox.pack_start(recbox, false, false, 1);
+ mutebox.pack_start(*mute_button, true, false);
+ btnbox.pack_start(mutebox, false, false, 1);
+ solobox.pack_start(*solo_button, true, false);
+ btnbox.pack_start(solobox, false, false, 1);
+
rec_enable_button->set_corner_radius(2);
- btnbox.set_size_request(-1, 16);
+ rec_enable_button->set_size_request(16, 16);
+
+ mute_button->set_corner_radius(2);
+ mute_button->set_size_request(16, 16);
+
+ solo_button->set_corner_radius(2);
+ solo_button->set_size_request(16, 16);
+
+ mutebox.set_size_request(16, 16);
+ solobox.set_size_request(16, 16);
+ recbox.set_size_request(16, 16);
+
+ update_button_box();
+ update_name_box();
pack_start (peakbx, false, false);
pack_start (meterbox, true, true);
pack_start (btnbox, false, false);
pack_start (namebx, false, false);
-
+ name_label.show();
peak_display.show();
peakbx.show();
meter_ticks1_area.show();
meter_align.show();
peak_align.show();
btnbox.show();
- name_label.show();
- namebx.show();
_route->shared_peak_meter()->ConfigurationChanged.connect (
route_connections, invalidator (*this), boost::bind (&MeterStrip::meter_configuration_changed, this, _1), gui_context()
ResetRoutePeakDisplays.connect (sigc::mem_fun(*this, &MeterStrip::reset_route_peak_display));
ResetGroupPeakDisplays.connect (sigc::mem_fun(*this, &MeterStrip::reset_group_peak_display));
RedrawMetrics.connect (sigc::mem_fun(*this, &MeterStrip::redraw_metrics));
+ SetMeterTypeMulti.connect (sigc::mem_fun(*this, &MeterStrip::set_meter_type_multi));
meter_configuration_changed (_route->shared_peak_meter()->input_streams ());
ColorsChanged.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed));
DPIReset.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed));
Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&MeterStrip::parameter_changed, this, _1), gui_context());
+ sess->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&MeterStrip::parameter_changed, this, _1), gui_context());
+
+ if (_route->is_master()) {
+ _strip_type = 4;
+ }
+ else if (boost::dynamic_pointer_cast<AudioTrack>(_route) == 0
+ && boost::dynamic_pointer_cast<MidiTrack>(_route) == 0) {
+ /* non-master bus */
+ _strip_type = 3;
+ }
+ else if (boost::dynamic_pointer_cast<MidiTrack>(_route)) {
+ _strip_type = 2;
+ }
+ else {
+ _strip_type = 1;
+ }
}
MeterStrip::~MeterStrip ()
delete this;
}
+void
+MeterStrip::set_session (Session* s)
+{
+ SessionHandlePtr::set_session (s);
+ if (!s) return;
+ s->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&MeterStrip::parameter_changed, this, _1), gui_context());
+ update_button_box();
+ update_name_box();
+}
+
void
MeterStrip::update_rec_display ()
{
void
MeterStrip::set_button_names()
{
+ mute_button->set_text (_("M"));
rec_enable_button->set_text ("");
rec_enable_button->set_image (::get_icon (X_("record_normal_red")));
+
+ if (_route && _route->solo_safe()) {
+ solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() | Gtkmm2ext::Insensitive));
+ } else {
+ solo_button->set_visual_state (Gtkmm2ext::VisualState (solo_button->visual_state() & ~Gtkmm2ext::Insensitive));
+ }
+ if (!Config->get_solo_control_is_listen_control()) {
+ solo_button->set_text (_("S"));
+ } else {
+ switch (Config->get_listen_position()) {
+ case AfterFaderListen:
+ solo_button->set_text (_("A"));
+ break;
+ case PreFaderListen:
+ solo_button->set_text (_("P"));
+ break;
+ }
+ }
+
}
void
}
ENSURE_GUI_THREAD (*this, &MeterStrip::strip_name_changed, what_changed)
name_label.set_text(_route->name());
+ ARDOUR_UI::instance()->set_tip (name_label, _route->name());
}
void
}
}
- // TODO draw Inactive routes or busses with different styles
if (boost::dynamic_pointer_cast<AudioTrack>(_route) == 0
&& boost::dynamic_pointer_cast<MidiTrack>(_route) == 0
) {
void
MeterStrip::on_size_request (Gtk::Requisition* r)
{
- meter_clear_pattern_cache();
VBox::on_size_request(r);
}
void
MeterStrip::on_size_allocate (Gtk::Allocation& a)
{
- meter_clear_pattern_cache();
const int wh = a.get_height();
int nh = ceilf(wh * .11f);
if (nh < 52) nh = 52;
meter_metric_area.queue_draw ();
}
+void
+MeterStrip::set_pos (int pos)
+{
+}
+
gint
MeterStrip::meter_ticks1_expose (GdkEventExpose *ev)
{
meter_ticks2_area.queue_draw();
}
+void
+MeterStrip::update_button_box ()
+{
+ if (!_session) return;
+ int height = 0;
+ if (_session->config.get_show_mute_on_meterbridge()) {
+ height += 18;
+ mutebox.show();
+ } else {
+ mutebox.hide();
+ }
+ if (_session->config.get_show_solo_on_meterbridge()) {
+ height += 18;
+ solobox.show();
+ } else {
+ solobox.hide();
+ }
+ if (_session->config.get_show_rec_on_meterbridge()) {
+ height += 18;
+ recbox.show();
+ } else {
+ recbox.hide();
+ }
+ btnbox.set_size_request(16, height);
+ check_resize();
+}
+
+void
+MeterStrip::update_name_box ()
+{
+ if (!_session) return;
+ if (_session->config.get_show_name_on_meterbridge()) {
+ namebx.show();
+ } else {
+ namebx.hide();
+ }
+}
+
void
MeterStrip::parameter_changed (std::string const & p)
{
if (p == "meter-peak") {
max_peak = -INFINITY;
}
+ else if (p == "show-rec-on-meterbridge") {
+ update_button_box();
+ }
+ else if (p == "show-mute-on-meterbridge") {
+ update_button_box();
+ }
+ else if (p == "show-solo-on-meterbridge") {
+ update_button_box();
+ }
+ else if (p == "show-name-on-meterbridge") {
+ update_name_box();
+ }
}
RadioMenuItem::Group group;
_suspend_menu_callbacks = true;
- add_level_meter_item (items, group, _("Peak"), MeterPeak);
- add_level_meter_item (items, group, _("RMS + Peak"), MeterKrms);
+ add_level_meter_item (items, group, ArdourMeter::meter_type_string(MeterPeak), MeterPeak);
+ add_level_meter_item (items, group, ArdourMeter::meter_type_string(MeterKrms), MeterKrms);
+ add_level_meter_item (items, group, ArdourMeter::meter_type_string(MeterIEC1), MeterIEC1);
+ add_level_meter_item (items, group, ArdourMeter::meter_type_string(MeterIEC2), MeterIEC2);
+ add_level_meter_item (items, group, ArdourMeter::meter_type_string(MeterVU), MeterVU);
+
+ MeterType cmt = _route->meter_type();
+ const std::string cmn = ArdourMeter::meter_type_string(cmt);
+
+ items.push_back (SeparatorElem());
+ items.push_back (MenuElem (string_compose(_("Change all in Group to %1"), cmn),
+ sigc::bind (SetMeterTypeMulti, -1, _route->route_group(), cmt)));
+ items.push_back (MenuElem (string_compose(_("Change all to %1"), cmn),
+ sigc::bind (SetMeterTypeMulti, 0, _route->route_group(), cmt)));
+ items.push_back (MenuElem (string_compose(_("Change same track-type to %1"), cmn),
+ sigc::bind (SetMeterTypeMulti, _strip_type, _route->route_group(), cmt)));
m->popup (ev->button, ev->time);
_suspend_menu_callbacks = false;
}
void
-MeterStrip::set_meter_type (MeterType m)
+MeterStrip::set_meter_type (MeterType type)
{
if (_suspend_menu_callbacks) return;
- level_meter->set_type (m);
+ level_meter->set_type (type);
}
void
-MeterStrip::meter_type_changed (MeterType t)
+MeterStrip::meter_type_changed (MeterType type)
{
- _route->set_meter_type(t);
+ _route->set_meter_type(type);
}
+void
+MeterStrip::set_meter_type_multi (int what, RouteGroup* group, MeterType type)
+{
+ switch (what) {
+ case -1:
+ if (_route && group == _route->route_group()) {
+ level_meter->set_type (type);
+ }
+ break;
+ case 0:
+ level_meter->set_type (type);
+ default:
+ if (what == _strip_type) {
+ level_meter->set_type (type);
+ }
+ break;
+ }
+}