From 0678d0ada1bfb1eaebb1e4d761ea0336b3537cbf Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 9 Jun 2016 12:59:18 -0400 Subject: use new ControlSlaveUI object in mixer strip --- gtk2_ardour/mixer_strip.cc | 117 +++------------------------------------------ gtk2_ardour/mixer_strip.h | 9 ++-- gtk2_ardour/route_ui.cc | 29 ----------- gtk2_ardour/route_ui.h | 6 +-- gtk2_ardour/wscript | 1 + 5 files changed, 13 insertions(+), 149 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index ada9730b3b..06f3babe96 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -103,6 +103,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, bool in_mixer) , _comment_button (_("Comments")) , trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero)) , _visibility (X_("mixer-element-visibility")) + , control_slave_ui (sess) { init (); @@ -134,6 +135,7 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session* sess, boost::shared_ptr rt , _comment_button (_("Comments")) , trim_control (ArdourKnob::default_elements, ArdourKnob::Flags (ArdourKnob::Detent | ArdourKnob::ArcToZero)) , _visibility (X_("mixer-element-visibility")) + , control_slave_ui (sess) { init (); set_route (rt); @@ -211,15 +213,6 @@ MixerStrip::init () } solo_iso_table.show (); - vca_button = manage (new ArdourButton (ArdourButton::default_elements)); - vca_button->set_no_show_all (true); - vca_button->set_name (X_("vca assign")); - vca_button->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); - vca_button->signal_button_release_event().connect (sigc::mem_fun (*this, &MixerStrip::vca_button_release), false); - UI::instance()->set_tip (*vca_button, _("VCA assignments")); - vca_button->set_text (_("-vca-")); - vca_button->show (); - rec_mon_table.set_homogeneous (true); rec_mon_table.set_row_spacings (2); rec_mon_table.set_col_spacings (2); @@ -315,7 +308,7 @@ MixerStrip::init () global_vpacker.pack_start (solo_iso_table, Gtk::PACK_SHRINK); global_vpacker.pack_start (mute_solo_table, Gtk::PACK_SHRINK); global_vpacker.pack_start (gpm, Gtk::PACK_SHRINK); - global_vpacker.pack_start (*vca_button, Gtk::PACK_SHRINK); + global_vpacker.pack_start (control_slave_ui, Gtk::PACK_SHRINK); global_vpacker.pack_start (bottom_button_table, Gtk::PACK_SHRINK); if (!ARDOUR::Profile->get_trx()) { global_vpacker.pack_start (output_button, Gtk::PACK_SHRINK); @@ -397,7 +390,7 @@ MixerStrip::init () _visibility.add (&solo_iso_table, X_("SoloIsoLock"), _("Solo Iso / Lock"), false); _visibility.add (&output_button, X_("Output"), _("Output"), false); _visibility.add (&_comment_button, X_("Comments"), _("Comments"), false); - _visibility.add (vca_button, X_("VCA"), _("VCA Assigns"), false); + _visibility.add (&control_slave_ui, X_("VCA"), _("VCA Assigns"), false); parameter_changed (X_("mixer-element-visibility")); UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &MixerStrip::parameter_changed)); @@ -483,6 +476,8 @@ MixerStrip::set_route (boost::shared_ptr rt) RouteUI::set_route (rt); + control_slave_ui.set_stripable (boost::dynamic_pointer_cast (rt)); + /* ProcessorBox needs access to _route so that it can read GUI object state. */ @@ -650,18 +645,12 @@ MixerStrip::set_route (boost::shared_ptr rt) _route->comment_changed.connect (route_connections, invalidator (*this), boost::bind (&MixerStrip::setup_comment_button, this), gui_context()); - _route->gain_control()->MasterStatusChange.connect (route_connections, - invalidator (*this), - boost::bind (&MixerStrip::update_vca_display, this), - gui_context()); - set_stuff_from_route (); /* now force an update of all the various elements */ update_mute_display (); update_solo_display (); - update_vca_display (); name_changed (); comment_changed (); route_group_changed (); @@ -2505,100 +2494,6 @@ MixerStrip::set_meter_type (MeterType t) gpm.set_type (t); } -void -MixerStrip::vca_menu_toggle (Gtk::CheckMenuItem* menuitem, uint32_t n) -{ - if (!_route) { - return; - } - - boost::shared_ptr vca = _session->vca_manager().vca_by_number (n); - - if (!vca) { - return; - } - - if (!_selected) { - /* if this strip is not selected, add it before carrying out - changes to assignment. the user probably didn't notice - that they were clicking on an unselected track. - */ - _mixer.select_strip (*this); - } - - if (!menuitem->get_active()) { - _mixer.do_vca_unassign (vca); - } else { - _mixer.do_vca_assign (vca); - } -} - -void -MixerStrip::vca_assign (boost::shared_ptr vca) -{ - if (!vca || !_route) { - return; - } - - _route->assign (vca); -} - -void -MixerStrip::vca_unassign (boost::shared_ptr vca) -{ - if (!_route) { - return; - } - - _route->unassign (vca); -} - -bool -MixerStrip::vca_button_release (GdkEventButton* ev) -{ - using namespace Gtk::Menu_Helpers; - - if (!_session) { - return false; - } - - /* primary click only */ - - if (ev->button != 1) { - return false; - } - - if (!_route) { - /* no route - nothing to do */ - return false; - } - - VCAList vcas (_session->vca_manager().vcas()); - - if (vcas.empty()) { - /* the button should not have been visible under these conditions */ - return true; - } - - Menu* menu = new Menu; - MenuList& items = menu->items(); - - items.push_back (MenuElem (_("Unassign"), sigc::bind (sigc::mem_fun (_mixer, &Mixer_UI::do_vca_unassign), boost::shared_ptr()))); - - for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) { - items.push_back (CheckMenuElem ((*v)->name())); - Gtk::CheckMenuItem* item = dynamic_cast (&items.back()); - if (_route->slaved_to (*v)) { - item->set_active (true); - } - item->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &MixerStrip::vca_menu_toggle), item, (*v)->number())); - } - - menu->popup (1, ev->time); - - return true; -} - void MixerStrip::update_track_number_visibility () { diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 408315dbb5..9bffeb419e 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -48,6 +48,7 @@ #include "pbd/fastlog.h" #include "axis_view.h" +#include "control_slave_ui.h" #include "ardour_knob.h" #include "route_ui.h" #include "gain_meter.h" @@ -137,9 +138,6 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox void toggle_processors (); void ab_plugins (); - void vca_assign (boost::shared_ptr); - void vca_unassign (boost::shared_ptr); - void show_selected (); static MixerStrip* entered_mixer_strip() { return _entered_mixer_strip; } @@ -330,10 +328,9 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox std::string meter_point_string (ARDOUR::MeterPoint); - void vca_menu_toggle (Gtk::CheckMenuItem*, uint32_t n); - bool vca_button_release (GdkEventButton* ev); - void update_track_number_visibility (); + + ControlSlaveUI control_slave_ui; }; #endif /* __ardour_mixer_strip__ */ diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 9dc8bd8727..7f43a9e251 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -153,7 +153,6 @@ RouteUI::init () multiple_mute_change = false; multiple_solo_change = false; _i_am_the_modifier = 0; - vca_button = 0; input_selector = 0; output_selector = 0; @@ -1287,34 +1286,6 @@ RouteUI::update_mute_display () mute_button->set_active_state (mute_active_state (_session, _route)); } -void -RouteUI::update_vca_display () -{ - if (!vca_button) { - return; - } - - VCAList vcas (_session->vca_manager().vcas()); - string label; - - for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) { - if (_route->slaved_to (*v)) { - if (!label.empty()) { - label += ' '; - } - label += PBD::to_string ((*v)->number(), std::dec); - } - } - - if (label.empty()) { - label = _("-vca-"); - vca_button->set_active_state (Gtkmm2ext::Off); - } else { - vca_button->set_active_state (Gtkmm2ext::ExplicitActive); - } - - vca_button->set_text (label); -} void RouteUI::route_rec_enable_changed () diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index d8e50ed8c2..ecd4ed520d 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -56,6 +56,7 @@ namespace Gtk { class ArdourButton; class ArdourWindow; class IOSelectorWindow; +class ControlSlaveUI; class RoutePinWindowProxy : public WM::ProxyBase { @@ -126,7 +127,6 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectab ArdourButton* solo_safe_led; ArdourButton* solo_isolated_led; - ArdourButton* vca_button; Gtk::Label monitor_input_button_label; Gtk::Label monitor_disk_button_label; @@ -241,8 +241,6 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectab void update_solo_display (); - void update_vca_display (); - virtual void map_frozen (); void adjust_latency (); @@ -325,6 +323,8 @@ class RouteUI : public virtual ARDOUR::SessionHandlePtr, public virtual Selectab SoloMuteRelease* _solo_release; SoloMuteRelease* _mute_release; + ControlSlaveUI* csu; + private: void setup_invert_buttons (); void set_invert_button_state (); diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index e928c7fe8c..d55945087b 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -63,6 +63,7 @@ gtk2_ardour_sources = [ 'configinfo.cc', 'control_point.cc', 'control_point_dialog.cc', + 'control_slave_ui.cc', 'cursor_context.cc', 'curvetest.cc', 'debug.cc', -- cgit v1.2.3