fix re-drawing of splitting icon
[ardour.git] / gtk2_ardour / global_port_matrix.cc
index 5e5218bda857d69799b82d4e1869c9e9967d5f4f..8c1fde30827f8294182442d956f709c09ec0a73b 100644 (file)
@@ -42,14 +42,22 @@ GlobalPortMatrix::GlobalPortMatrix (Gtk::Window* p, Session* s, DataType t)
 void
 GlobalPortMatrix::setup_ports (int dim)
 {
+       if (!_session) {
+               return;
+       }
+
        _ports[dim].suspend_signals ();
-       _ports[dim].gather (_session, type(), dim == IN, false);
+       _ports[dim].gather (_session, type(), dim == IN, false, show_only_bundles ());
        _ports[dim].resume_signals ();
 }
 
 void
 GlobalPortMatrix::set_state (BundleChannel c[2], bool s)
 {
+       if (!_session) {
+               return;
+       }
+
        Bundle::PortList const & in_ports = c[IN].bundle->channel_ports (c[IN].channel);
        Bundle::PortList const & out_ports = c[OUT].bundle->channel_ports (c[OUT].channel);
 
@@ -148,8 +156,8 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
 }
 
 GlobalPortMatrixWindow::GlobalPortMatrixWindow (Session* s, DataType t)
-       : ArdourDialog (X_("reset me soon"))
-        , _port_matrix (this, s, t)
+       : ArdourWindow (X_("reset me soon"))
+       , _port_matrix (this, s, t)
 {
        switch (t) {
        case DataType::AUDIO:
@@ -160,7 +168,9 @@ GlobalPortMatrixWindow::GlobalPortMatrixWindow (Session* s, DataType t)
                break;
        }
 
-       get_vbox()->pack_start (_port_matrix, true, true);
+       signal_key_press_event().connect (sigc::mem_fun (_port_matrix, &PortMatrix::key_press));
+
+       add (_port_matrix);
        _port_matrix.show ();
 }
 
@@ -176,6 +186,19 @@ void
 GlobalPortMatrixWindow::set_session (Session* s)
 {
        _port_matrix.set_session (s);
+
+       if (!s) {
+               hide ();
+       }
+}
+
+void
+GlobalPortMatrix::set_session (Session *s)
+{
+       SessionHandlePtr::set_session (s);
+       if (!s) return;
+       setup_all_ports ();
+       init();
 }
 
 string