change tooltip for group tab to suggest click-to-(de)activate
[ardour.git] / gtk2_ardour / ardour_ui_dialogs.cc
index 7cbf0df3e2ca6d98f2af32766ede7fa4cd5d6472..87f66632af501329c51d55f63e1177e0cd709022 100644 (file)
@@ -24,6 +24,7 @@
 */
 
 #include "ardour/session.h"
+#include "ardour/audioengine.h"
 
 #include "actions.h"
 #include "ardour_ui.h"
 #include "theme_manager.h"
 #include "bundle_manager.h"
 #include "keyeditor.h"
+#include "gui_thread.h"
+#include "midi_tracer.h"
+#include "add_route_dialog.h"
+#include "global_port_matrix.h"
 
 #include "i18n.h"
 
@@ -55,14 +60,28 @@ ARDOUR_UI::set_session (Session *s)
                return;
        }
 
-       if (location_ui) {
-               location_ui->set_session(s);
+       if (location_ui->get()) {
+               location_ui->get()->set_session(s);
        }
 
        if (route_params) {
                route_params->set_session (s);
        }
 
+       if (add_route_dialog) {
+               add_route_dialog->set_session (s);
+       }
+
+       if (session_option_editor) {
+               session_option_editor->set_session (s);
+       }
+
+       for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
+               if (_global_port_matrix[*i]->get()) {
+                       _global_port_matrix[*i]->get()->set_session (_session);
+               }
+       }
+
        primary_clock.set_session (s);
        secondary_clock.set_session (s);
        big_clock.set_session (s);
@@ -80,7 +99,7 @@ ARDOUR_UI::set_session (Session *s)
                ActionManager::set_sensitive (ActionManager::range_sensitive_actions, false);
        }
 
-       if (!_session->control_out()) {
+       if (!_session->monitor_out()) {
                Glib::RefPtr<Action> act = ActionManager::get_action (X_("options"), X_("SoloViaBus"));
                if (act) {
                        act->set_sensitive (false);
@@ -113,14 +132,20 @@ ARDOUR_UI::set_session (Session *s)
        Blink.connect (sigc::mem_fun(*this, &ARDOUR_UI::sync_blink));
        Blink.connect (sigc::mem_fun(*this, &ARDOUR_UI::audition_blink));
 
-       _session->Xrun.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::xrun_handler));
-       _session->RecordStateChanged.connect (_session_connections, sigc::mem_fun (*this, &ARDOUR_UI::record_state_changed));
-       _session->locations()->added.connect (_session_connections, sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change));
-       _session->locations()->removed.connect (_session_connections, sigc::mem_fun (*this, &ARDOUR_UI::handle_locations_change));
-       _session->TransportStateChange.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::map_transport_state));
-       _session->AuditionActive.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::auditioning_changed));
-       _session->SoloActive.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::soloing_changed));
-       _session->DirtyChanged.connect (_session_connections, sigc::mem_fun(*this, &ARDOUR_UI::update_autosave));
+       _session->RecordStateChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::record_state_changed, this), gui_context());
+       _session->StepEditStatusChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::step_edit_status_change, this, _1), gui_context());
+       _session->TransportStateChange.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::map_transport_state, this), gui_context());
+       _session->DirtyChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::update_autosave, this), gui_context());
+
+       _session->Xrun.connect (_session_connections, MISSING_INVALIDATOR, ui_bind (&ARDOUR_UI::xrun_handler, this, _1), gui_context());
+       _session->SoloActive.connect (_session_connections, MISSING_INVALIDATOR, ui_bind (&ARDOUR_UI::soloing_changed, this, _1), gui_context());
+       _session->AuditionActive.connect (_session_connections, MISSING_INVALIDATOR, ui_bind (&ARDOUR_UI::auditioning_changed, this, _1), gui_context());
+       _session->locations()->added.connect (_session_connections, MISSING_INVALIDATOR, ui_bind (&ARDOUR_UI::handle_locations_change, this, _1), gui_context());
+       _session->locations()->removed.connect (_session_connections, MISSING_INVALIDATOR, ui_bind (&ARDOUR_UI::handle_locations_change, this, _1), gui_context());
+
+#ifdef HAVE_JACK_SESSION
+       engine->JackSessionEvent.connect (*_session, MISSING_INVALIDATOR, ui_bind (&Session::jack_session_event, _session, _1), gui_context());
+#endif
 
        /* Clocks are on by default after we are connected to a session, so show that here.
        */
@@ -199,14 +224,39 @@ ARDOUR_UI::toggle_big_clock_window ()
                RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
 
                if (tact->get_active()) {
-                       big_clock_window->show_all ();
-                       big_clock_window->present ();
+                       big_clock_window->get()->show_all ();
+                       big_clock_window->get()->present ();
                } else {
-                       big_clock_window->hide ();
+                       big_clock_window->get()->hide ();
                }
        }
 }
 
+void
+ARDOUR_UI::new_midi_tracer_window ()
+{
+       RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("NewMIDITracer"));
+       if (!act) {
+               return;
+       }
+
+       std::list<MidiTracer*>::iterator i = _midi_tracer_windows.begin ();
+       while (i != _midi_tracer_windows.end() && (*i)->get_visible() == true) {
+               ++i;
+       }
+
+       if (i == _midi_tracer_windows.end()) {
+               /* all our MIDITracer windows are visible; make a new one */
+               MidiTracer* t = new MidiTracer ();
+               manage_window (*t);
+               t->show_all ();
+               _midi_tracer_windows.push_back (t);
+       } else {
+               /* re-use the hidden one */
+               (*i)->show_all ();
+       }
+}
+
 void
 ARDOUR_UI::toggle_rc_options_window ()
 {
@@ -253,10 +303,10 @@ ARDOUR_UI::toggle_session_options_window ()
 int
 ARDOUR_UI::create_location_ui ()
 {
-       if (location_ui == 0) {
-               location_ui = new LocationUIWindow ();
-               location_ui->set_session (_session);
-               location_ui->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleLocations")));
+       if (location_ui->get() == 0) {
+               location_ui->set (new LocationUIWindow ());
+               location_ui->get()->set_session (_session);
+               location_ui->get()->signal_unmap().connect (sigc::bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleLocations")));
        }
        return 0;
 }
@@ -273,10 +323,10 @@ ARDOUR_UI::toggle_location_window ()
                RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
 
                if (tact->get_active()) {
-                       location_ui->show_all ();
-                       location_ui->present ();
+                       location_ui->get()->show_all ();
+                       location_ui->get()->present ();
                } else {
-                       location_ui->hide ();
+                       location_ui->get()->hide ();
                }
        }
 }