From eebbf64484f3b939b92b2d2dda75858c7c11b8e5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 2 Oct 2015 07:32:49 -0400 Subject: [PATCH] provide Main/cancel-solo as an action and make rude solo button(s) use it --- gtk2_ardour/ardour_ui.cc | 12 ++++++++++++ gtk2_ardour/ardour_ui.h | 1 + gtk2_ardour/ardour_ui2.cc | 16 ++-------------- gtk2_ardour/ardour_ui_ed.cc | 6 ++++++ gtk2_ardour/monitor_section.cc | 17 ++--------------- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 9ec13e4a7c..bc1587b7cc 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -4957,3 +4957,15 @@ ARDOUR_UI::hide_application () { Application::instance ()-> hide (); } + +void +ARDOUR_UI::cancel_solo () +{ + if (_session) { + if (_session->soloing()) { + _session->set_solo (_session->get_routes(), false); + } else if (_session->listening()) { + _session->set_listen (_session->get_routes(), false); + } + } +} diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 4f572157b1..8b10692125 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -480,6 +480,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void blink_handler (bool); sigc::connection blink_connection; + void cancel_solo (); void solo_blink (bool); void sync_blink (bool); void audition_blink (bool); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 116cfc95a3..d63fb0ac21 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -324,7 +324,8 @@ ARDOUR_UI::setup_transport () /* CANNOT sigc::bind these to clicked or toggled, must use pressed or released */ solo_alert_button.set_name ("rude solo"); - solo_alert_button.signal_button_press_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::solo_alert_press), false); + act = ActionManager::get_action (X_("Main"), X_("cancel-solo")); + solo_alert_button.set_related_action (act); auditioning_alert_button.set_name ("rude audition"); auditioning_alert_button.signal_button_press_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::audition_alert_press), false); feedback_alert_button.set_name ("feedback alert"); @@ -527,19 +528,6 @@ ARDOUR_UI::audition_alert_press (GdkEventButton*) return true; } -bool -ARDOUR_UI::solo_alert_press (GdkEventButton*) -{ - if (_session) { - if (_session->soloing()) { - _session->set_solo (_session->get_routes(), false); - } else if (_session->listening()) { - _session->set_listen (_session->get_routes(), false); - } - } - return true; -} - bool ARDOUR_UI::feedback_alert_press (GdkEventButton *) { diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index a290814de7..fb077e49af 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -132,6 +132,12 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); + + act = ActionManager::register_action (main_actions, X_("cancel-solo"), _("Cancel Solo"), sigc::mem_fun(*this, &ARDOUR_UI::cancel_solo)); + ActionManager::session_sensitive_actions.push_back (act); + ActionManager::write_sensitive_actions.push_back (act); + + act = ActionManager::register_action (main_actions, X_("OpenVideo"), _("Open Video"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::add_video), (Gtk::Window*) 0)); ActionManager::session_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 5335b3ee1c..aa5a85ac94 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -115,7 +115,8 @@ MonitorSection::MonitorSection (Session* s) Timers::blink_connect (sigc::mem_fun (*this, &MonitorSection::do_blink)); - rude_solo_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_solo), false); + act = ActionManager::get_action (X_("Main"), X_("cancel-solo")); + rude_solo_button.set_related_action (act); UI::instance()->set_tip (rude_solo_button, _("When active, something is soloed.\nClick to de-solo everything")); rude_iso_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MonitorSection::cancel_isolate), false); @@ -1079,20 +1080,6 @@ MonitorSection::solo_blink (bool onoff) } } -bool -MonitorSection::cancel_solo (GdkEventButton*) -{ - if (_session) { - if (_session->soloing()) { - _session->set_solo (_session->get_routes(), false); - } else if (_session->listening()) { - _session->set_listen (_session->get_routes(), false); - } - } - - return true; -} - bool MonitorSection::cancel_isolate (GdkEventButton*) {