diff --git a/gtk2_ardour/meter_strip.cc b/gtk2_ardour/meter_strip.cc index c493a1ee14..8a782ac97f 100644 --- a/gtk2_ardour/meter_strip.cc +++ b/gtk2_ardour/meter_strip.cc @@ -136,6 +136,7 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr rt) , _strip_type (0) , _metricmode (-1) , level_meter (0) + , gain_control (ArdourKnob::default_elements, ArdourKnob::Detent) , _suspend_menu_callbacks (false) { mtr_vbox.set_spacing (PX_SCALE(2, 2)); @@ -218,6 +219,17 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr rt) solobox.pack_start(*solo_button, true, false); btnbox.pack_start(solobox, false, false, 1); + /* Fader/Gain */ + gain_control.set_size_request (PX_SCALE (18, 18), PX_SCALE (18, 18)); + gain_control.set_tooltip_prefix (_("Level: ")); + gain_control.set_name ("trim knob"); // XXX + gain_control.StartGesture.connect (sigc::mem_fun (*this, &MeterStrip::gain_start_touch)); + gain_control.StopGesture.connect (sigc::mem_fun (*this, &MeterStrip::gain_end_touch)); + gain_control.set_controllable (_route->gain_control ()); + + gain_box.pack_start(gain_control, true, false); + btnbox.pack_start(gain_box, false, false, 1); + rec_enable_button->set_corner_radius(2); rec_enable_button->set_size_request (PX_SCALE(18, 18), PX_SCALE(18, 18)); @@ -238,6 +250,7 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr rt) recbox.set_size_request (PX_SCALE(18, 18), PX_SCALE(18, 18)); mon_in_box.set_size_request (PX_SCALE(18, 18), PX_SCALE(18, 18)); mon_disk_box.set_size_request (PX_SCALE(18, 18), PX_SCALE(18, 18)); + gain_box.set_size_request (PX_SCALE(18, 18), PX_SCALE(18, 18)); spacer.set_size_request(-1,0); update_button_box(); @@ -262,6 +275,7 @@ MeterStrip::MeterStrip (Session* sess, boost::shared_ptr rt) name_label.show(); peak_display.show(); peakbx.show(); + gain_control.show (); meter_ticks1_area.show(); meter_ticks2_area.show(); meterbox.show(); @@ -764,6 +778,12 @@ MeterStrip::update_button_box () mon_in_box.hide(); mon_disk_box.hide(); } + if (_session->config.get_show_fader_on_meterbridge ()) { + height += PX_SCALE(18, 18) + PX_SCALE(2, 2); + gain_box.show (); + } else { + gain_box.hide (); + } btnbox.set_size_request(PX_SCALE(18, 18), height); check_resize(); } @@ -800,6 +820,9 @@ MeterStrip::parameter_changed (std::string const & p) else if (p == "show-monitor-on-meterbridge") { update_button_box(); } + else if (p == "show-fader-on-meterbridge") { + update_button_box(); + } else if (p == "meterbridge-label-height") { queue_resize(); } @@ -989,3 +1012,14 @@ MeterStrip::color () const return RouteUI::route_color (); } +void +MeterStrip::gain_start_touch () +{ + _route->gain_control ()->start_touch (timepos_t (_session->transport_sample ())); +} + +void +MeterStrip::gain_end_touch () +{ + _route->gain_control ()->stop_touch (timepos_t (_session->transport_sample ())); +} diff --git a/gtk2_ardour/meter_strip.h b/gtk2_ardour/meter_strip.h index f2d46256ec..03c454bb7a 100644 --- a/gtk2_ardour/meter_strip.h +++ b/gtk2_ardour/meter_strip.h @@ -35,6 +35,7 @@ #include "ardour/ardour.h" #include "widgets/ardour_button.h" +#include "widgets/ardour_knob.h" #include "level_meter.h" #include "route_ui.h" @@ -121,6 +122,7 @@ private: Gtk::HBox recbox; Gtk::HBox mon_in_box; Gtk::HBox mon_disk_box; + Gtk::HBox gain_box; Gtk::Alignment meter_align; Gtk::Alignment peak_align; @@ -140,6 +142,8 @@ private: LevelMeterHBox *level_meter; + ArdourWidgets::ArdourKnob gain_control; + void route_property_changed (const PBD::PropertyChange&); void meter_configuration_changed (ARDOUR::ChanCount); void meter_type_changed (ARDOUR::MeterType); @@ -147,6 +151,9 @@ private: bool peak_button_release (GdkEventButton*); + void gain_start_touch (); + void gain_end_touch (); + void parameter_changed (std::string const & p); void redraw_metrics (); void update_button_box (); diff --git a/gtk2_ardour/meterbridge.cc b/gtk2_ardour/meterbridge.cc index ec1bf70b88..74a02abfcd 100644 --- a/gtk2_ardour/meterbridge.cc +++ b/gtk2_ardour/meterbridge.cc @@ -760,6 +760,9 @@ Meterbridge::parameter_changed (std::string const & p) else if (p == "show-monitor-on-meterbridge") { scroller.queue_resize(); } + else if (p == "show-fader-on-meterbridge") { + scroller.queue_resize(); + } else if (p == "track-name-number") { scroller.queue_resize(); } diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index 865574ee87..8f7903ec99 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -331,6 +331,13 @@ SessionOptionEditor::SessionOptionEditor (Session* s) sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_monitor_on_meterbridge) )); + add_option (_("Meterbridge"), new BoolOption ( + "show-fader-on-meterbridge", + _("Fader as Gain Knob"), + sigc::mem_fun (*_session_config, &SessionConfiguration::get_show_fader_on_meterbridge), + sigc::mem_fun (*_session_config, &SessionConfiguration::set_show_fader_on_meterbridge) + )); + add_option (_("Meterbridge"), new OptionEditorHeading (_("Name Labels"))); add_option (_("Meterbridge"), new BoolOption (