Foldback: use RouteUI send-spill functions

This resolves ambiguities of overloaded non-virtual methods
that used shared protected variables (send_blink_connection).

It fixes "show sends" of foldback busses (spilling the send
controls) and allows for showing showing other sends directly
without first disabling it.

This fixes some related issues with inheritance and
signal propagation.
This commit is contained in:
Robin Gareus 2021-03-27 15:52:14 +01:00
parent 212b08b422
commit 24499fa7da
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
4 changed files with 64 additions and 123 deletions

View file

@ -189,12 +189,14 @@ FoldbackSend::button_release (GdkEventButton* ev)
if (Keyboard::is_delete_event (ev)) {
remove_me ();
return true;
} else if (Keyboard::is_button2_event (ev)
#ifndef __APPLE__
&& (Keyboard::no_modifier_keys_pressed (ev) && ((ev->state & Gdk::BUTTON2_MASK) == Gdk::BUTTON2_MASK))
#endif
) {
_send_proc->enable (!_send_proc->enabled ());
return true;
}
return false;
}
@ -396,12 +398,6 @@ FoldbackStrip::init ()
name_button.set_text_ellipsize (Pango::ELLIPSIZE_END);
name_button.set_layout_ellipsize_width (PX_SCALE (_width) * PANGO_SCALE);
// invertbuttons and box in route_ui
_show_sends_button.set_name ("send alert button");
_show_sends_button.set_text (_("Show Sends"));
UI::instance ()->set_tip (&_show_sends_button, _("Show the strips that send to this bus, and control them from the faders"), "");
send_display.set_flags (CAN_FOCUS);
send_display.set_spacing (4);
@ -473,7 +469,7 @@ FoldbackStrip::init ()
// or hides.
global_vpacker.pack_start (prev_next_box, Gtk::PACK_SHRINK);
global_vpacker.pack_start (name_button, Gtk::PACK_SHRINK);
global_vpacker.pack_start (_show_sends_button, Gtk::PACK_SHRINK);
global_vpacker.pack_start (*show_sends_button, Gtk::PACK_SHRINK);
global_vpacker.pack_start (_invert_button_box, Gtk::PACK_SHRINK);
global_vpacker.pack_start (send_scroller, true, true);
#ifndef MIXBUS
@ -510,8 +506,7 @@ FoldbackStrip::init ()
_previous_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::cycle_foldbacks), false));
_next_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::cycle_foldbacks), true));
_hide_button.signal_clicked.connect (sigc::mem_fun (*this, &FoldbackStrip::hide_clicked));
_show_sends_button.signal_clicked.connect (sigc::mem_fun (*this, &FoldbackStrip::show_sends_clicked));
send_scroller.signal_button_press_event ().connect (sigc::mem_fun (*this, &FoldbackStrip::send_button_press_event));
send_scroller.signal_button_press_event ().connect (sigc::mem_fun (*this, &RouteUI::show_sends_press));
_comment_button.signal_clicked.connect (sigc::mem_fun (*this, &RouteUI::toggle_comment_editor));
add_events (Gdk::BUTTON_RELEASE_MASK |
@ -521,7 +516,7 @@ FoldbackStrip::init ()
set_flags (get_flags () | Gtk::CAN_FOCUS);
signal_enter_notify_event ().connect (sigc::mem_fun (*this, &FoldbackStrip::mixer_strip_enter_event));
signal_enter_notify_event ().connect (sigc::mem_fun (*this, &FoldbackStrip::fb_strip_enter_event));
Mixer_UI::instance ()->show_spill_change.connect (sigc::mem_fun (*this, &FoldbackStrip::spill_change));
}
@ -535,7 +530,7 @@ FoldbackStrip::~FoldbackStrip ()
}
bool
FoldbackStrip::mixer_strip_enter_event (GdkEventCrossing* /*ev*/)
FoldbackStrip::fb_strip_enter_event (GdkEventCrossing* /*ev*/)
{
deselect_all_processors ();
return false;
@ -564,13 +559,6 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
if (!rt) {
clear_send_box ();
update_sensitivity ();
if (_showing_sends) {
Mixer_UI::instance ()->show_spill (boost::shared_ptr<ARDOUR::Stripable> ());
_showing_sends = false;
send_blink_connection.disconnect ();
}
RouteUI::set_route (rt);
RouteUI::self_delete ();
return;
}
@ -580,11 +568,6 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
insert_box->set_route (_route);
update_fb_level_control ();
_showing_sends = false;
_show_sends_button.set_active (false);
send_blink_connection.disconnect ();
/* setup panners */
panner_ui ().set_panner (_route->main_outs ()->panner_shell (), _route->main_outs ()->panner ());
panner_ui ().setup_pan ();
@ -621,6 +604,7 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
panners.show_all ();
update_output_display ();
reset_strip_style ();
setup_comment_button ();
add_events (Gdk::BUTTON_RELEASE_MASK);
update_sensitivity ();
@ -631,7 +615,7 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
name_button.show ();
send_display.show ();
send_scroller.show ();
_show_sends_button.show ();
show_sends_button->show ();
insert_box->show ();
_meter->show ();
master_box.show ();
@ -875,7 +859,9 @@ FoldbackStrip::cycle_foldbacks (bool next)
--i;
}
set_route (*i);
if (_showing_sends) {
set_showing_sends_to (_route);
Mixer_UI::instance ()->show_spill (_route);
}
}
@ -909,23 +895,8 @@ FoldbackStrip::spill_change (boost::shared_ptr<Stripable> s)
{
if (s == _route) {
_showing_sends = true;
_show_sends_button.set_active (true);
send_blink_connection.disconnect ();
send_blink_connection = Timers::blink_connect (sigc::mem_fun (*this, &FoldbackStrip::send_blink));
} else {
_showing_sends = false;
_show_sends_button.set_active (false);
send_blink_connection.disconnect ();
}
}
void
FoldbackStrip::show_sends_clicked ()
{
if (_showing_sends) {
Mixer_UI::instance ()->show_spill (boost::shared_ptr<Stripable> ());
} else {
Mixer_UI::instance ()->show_spill (_route);
}
}
@ -940,20 +911,6 @@ FoldbackStrip::fast_update ()
_meter->set (log_meter0dB (meter_level));
}
void
FoldbackStrip::send_blink (bool onoff)
{
if (!(&_show_sends_button)) {
return;
}
if (onoff) {
_show_sends_button.set_active_state (Gtkmm2ext::ExplicitActive);
} else {
_show_sends_button.unset_active_state ();
}
}
void
FoldbackStrip::route_property_changed (const PropertyChange& what_changed)
{
@ -982,6 +939,8 @@ FoldbackStrip::reset_strip_style ()
void
FoldbackStrip::set_button_names ()
{
show_sends_button->set_text (_("Show Sends"));
solo_button->set_sensitive (Config->get_solo_control_is_listen_control ());
switch (Config->get_listen_position ()) {
case AfterFaderListen:
@ -1012,7 +971,7 @@ FoldbackStrip::deselect_all_processors ()
}
void
FoldbackStrip::create_selected_sends (bool post_fader)
FoldbackStrip::create_selected_sends (ARDOUR::Placement p, bool)
{
boost::shared_ptr<StripableList> slist (new StripableList);
PresentationInfo::Flag fl = PresentationInfo::MixerRoutes;
@ -1022,45 +981,12 @@ FoldbackStrip::create_selected_sends (bool post_fader)
if ((*i)->is_selected () && !(*i)->is_master () && !(*i)->is_monitor ()) {
boost::shared_ptr<Route> rt = boost::dynamic_pointer_cast<Route> (*i);
if (rt) {
rt->add_foldback_send (_route, post_fader);
rt->add_foldback_send (_route, p == PostFader);
}
}
}
}
bool
FoldbackStrip::send_button_press_event (GdkEventButton* ev)
{
if (Keyboard::is_context_menu_event (ev)) {
Menu* menu = build_sends_menu ();
menu->popup (3, ev->time);
return true;
}
return false;
}
Gtk::Menu*
FoldbackStrip::build_sends_menu ()
{
using namespace Menu_Helpers;
Menu* menu = manage (new Menu);
MenuList& items = menu->items ();
menu->set_name ("ArdourContextMenu");
items.push_back (
MenuElem (_("Assign selected tracks and buses (prefader)"), sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::create_selected_sends), false)));
items.push_back (
MenuElem (_("Assign selected tracks and buses (postfader)"), sigc::bind (sigc::mem_fun (*this, &FoldbackStrip::create_selected_sends), true)));
items.push_back (MenuElem (_("Copy track/bus gains to sends"), sigc::mem_fun (*this, &RouteUI::set_sends_gain_from_track)));
items.push_back (MenuElem (_("Set sends gain to -inf"), sigc::mem_fun (*this, &RouteUI::set_sends_gain_to_zero)));
items.push_back (MenuElem (_("Set sends gain to 0dB"), sigc::mem_fun (*this, &RouteUI::set_sends_gain_to_unity)));
return menu;
}
void
FoldbackStrip::duplicate_current_fb ()
{

View file

@ -147,6 +147,10 @@ public:
void deselect_all_processors ();
protected:
void create_sends (ARDOUR::Placement, bool) {}
void create_selected_sends (ARDOUR::Placement, bool);
private:
void init ();
void setup_comment_button ();
@ -163,20 +167,15 @@ private:
void cycle_foldbacks (bool next);
void update_sensitivity ();
void spill_change (boost::shared_ptr<ARDOUR::Stripable>);
void show_sends_clicked ();
void send_blink (bool);
bool name_button_button_press (GdkEventButton*);
bool send_button_press_event (GdkEventButton* ev);
void create_selected_sends (bool include_buses);
void route_property_changed (const PBD::PropertyChange&);
void name_changed ();
void duplicate_current_fb ();
void reset_strip_style ();
bool mixer_strip_enter_event (GdkEventCrossing*);
bool fb_strip_enter_event (GdkEventCrossing*);
Gtk::Menu* build_route_ops_menu ();
Gtk::Menu* build_route_select_menu ();
Gtk::Menu* build_sends_menu ();
Mixer_UI& _mixer;
@ -200,7 +199,6 @@ private:
IOButton output_button;
ArdourWidgets::ArdourButton name_button;
ArdourWidgets::ArdourButton _show_sends_button;
ArdourWidgets::ArdourButton _previous_button;
ArdourWidgets::ArdourButton _next_button;
ArdourWidgets::ArdourButton _hide_button;

View file

@ -1040,36 +1040,44 @@ RouteUI::build_sends_menu ()
sends_menu->set_name ("ArdourContextMenu");
MenuList& items = sends_menu->items();
items.push_back (
MenuElem(_("Assign all tracks (prefader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_sends), PreFader, false))
);
if (!is_foldbackbus ()) {
items.push_back (
MenuElem(_("Assign all tracks (prefader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_sends), PreFader, false))
);
items.push_back (
MenuElem(_("Assign all tracks and busses (prefader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_sends), PreFader, true))
);
items.push_back (
MenuElem(_("Assign all tracks and busses (prefader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_sends), PreFader, true))
);
items.push_back (
MenuElem(_("Assign all tracks (postfader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_sends), PostFader, false))
);
items.push_back (
MenuElem(_("Assign all tracks (postfader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_sends), PostFader, false))
);
items.push_back (
MenuElem(_("Assign all tracks and busses (postfader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_sends), PostFader, true))
);
items.push_back (
MenuElem(_("Assign all tracks and busses (postfader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_sends), PostFader, true))
);
}
items.push_back (
MenuElem(_("Assign selected tracks (prefader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_selected_sends), PreFader, false))
);
items.push_back (
MenuElem(_("Assign selected tracks and busses (prefader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_selected_sends), PreFader, true)));
if (!is_foldbackbus ()) {
items.push_back (
MenuElem(_("Assign selected tracks and busses (prefader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_selected_sends), PreFader, true)));
}
items.push_back (
MenuElem(_("Assign selected tracks (postfader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_selected_sends), PostFader, false))
);
items.push_back (
MenuElem(_("Assign selected tracks and busses (postfader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_selected_sends), PostFader, true))
);
if (!is_foldbackbus ()) {
items.push_back (
MenuElem(_("Assign selected tracks and busses (postfader)"), sigc::bind (sigc::mem_fun (*this, &RouteUI::create_selected_sends), PostFader, true))
);
}
items.push_back (SeparatorElem());
items.push_back (MenuElem(_("Copy track/bus gains to sends"), sigc::mem_fun (*this, &RouteUI::set_sends_gain_from_track)));
items.push_back (MenuElem(_("Set sends gain to -inf"), sigc::mem_fun (*this, &RouteUI::set_sends_gain_to_zero)));
@ -1125,7 +1133,7 @@ RouteUI::set_sends_gain_to_unity ()
bool
RouteUI::show_sends_press(GdkEventButton* ev)
{
if (ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS ) {
if (ev->type == GDK_2BUTTON_PRESS || ev->type == GDK_3BUTTON_PRESS) {
return true;
}
@ -1144,7 +1152,7 @@ RouteUI::show_sends_press(GdkEventButton* ev)
sends_menu->popup (0, ev->time);
} else {
} else if (ev->button == 1) {
boost::shared_ptr<Route> s = _showing_sends_to.lock ();
@ -1156,9 +1164,10 @@ RouteUI::show_sends_press(GdkEventButton* ev)
Mixer_UI::instance()->show_spill (_route);
}
}
return true;
}
return true;
return false;
}
bool
@ -1871,6 +1880,12 @@ RouteUI::is_master () const
return _route && _route->is_master ();
}
bool
RouteUI::is_foldbackbus () const
{
return _route && _route->is_foldbackbus ();
}
boost::shared_ptr<Track>
RouteUI::track() const
{

View file

@ -103,6 +103,7 @@ public:
bool is_track() const;
bool is_master() const;
bool is_foldbackbus() const;
bool is_audio_track() const;
bool is_midi_track() const;
bool has_audio_outputs () const;
@ -175,13 +176,6 @@ public:
void edit_input_configuration ();
void edit_output_configuration ();
void build_sends_menu ();
void set_sends_gain_from_track ();
void set_sends_gain_to_zero ();
void set_sends_gain_to_unity ();
void create_sends (ARDOUR::Placement, bool);
void create_selected_sends (ARDOUR::Placement, bool);
void solo_changed(bool, void*);
void solo_changed_so_update_mute ();
void listen_changed(void*);
@ -301,6 +295,13 @@ protected:
virtual void start_step_editing () {}
virtual void stop_step_editing() {}
void build_sends_menu ();
void set_sends_gain_from_track ();
void set_sends_gain_to_zero ();
void set_sends_gain_to_unity ();
virtual void create_sends (ARDOUR::Placement, bool);
virtual void create_selected_sends (ARDOUR::Placement, bool);
void set_invert_sensitive (bool);
bool verify_new_route_name (const std::string& name);
@ -339,6 +340,8 @@ protected:
Gtk::Menu* playlist_action_menu;
static void set_showing_sends_to (boost::shared_ptr<ARDOUR::Route>);
private:
void setup_invert_buttons ();
void invert_menu_toggled (uint32_t);
@ -357,7 +360,6 @@ private:
StripableColorDialog _color_picker;
static void set_showing_sends_to (boost::shared_ptr<ARDOUR::Route>);
static boost::weak_ptr<ARDOUR::Route> _showing_sends_to;
static uint32_t _max_invert_buttons;