diff options
-rw-r--r-- | src/AlsaDriver.cpp | 4 | ||||
-rw-r--r-- | src/JackDriver.cpp | 16 | ||||
-rw-r--r-- | src/PatchageEvent.cpp | 9 |
3 files changed, 12 insertions, 17 deletions
diff --git a/src/AlsaDriver.cpp b/src/AlsaDriver.cpp index 058b0a1..5aad6aa 100644 --- a/src/AlsaDriver.cpp +++ b/src/AlsaDriver.cpp @@ -252,8 +252,10 @@ AlsaDriver::refresh_ports() m->add_port(create_port(m, port_name, false, addr)); } } - m->resize(); + _app->canvas()->add_item(m); + + m->resize(); } } } diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index e088590..5572769 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -126,11 +126,14 @@ JackDriver::destroy_all_ports() boost::shared_ptr<PatchagePort> port = boost::dynamic_pointer_cast<PatchagePort>(*p); if (port && port->type() == JACK_AUDIO || port->type() == JACK_MIDI) { module->remove_port(port); + port->hide(); } } if (module->ports().empty()) _app->canvas()->remove_item(module); + else + module->resize(); } } @@ -258,19 +261,6 @@ JackDriver::refresh() m->resize(); } - - // Remove any since-removed ports - /*for (list<string>::iterator i = _removed_ports.begin(); i != _removed_ports.end(); ++i) { - const string module_name = (*i).substr(0, i->find(":")); - const string port_name = (*i).substr(i->find(":")+1); - - for (ItemMap::iterator m = _app->canvas()->items().begin(); m != _app->canvas()->items().end(); ++m) { - if (m->second->name() == module_name) - m->second->remove_port(port_name); - } - }*/ - - // Add all connections if (ports) for (int i=0; ports[i]; ++i) { diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp index f996495..a6b237f 100644 --- a/src/PatchageEvent.cpp +++ b/src/PatchageEvent.cpp @@ -111,13 +111,16 @@ PatchageEvent::execute(Patchage* patchage) SharedPtr<PatchageModule> module = PtrCast<PatchageModule>(port->module().lock()); assert(module); - //SharedPtr<PatchagePort> removed_port = PtrCast<PatchagePort>( - module->remove_port(port); - //assert(removed_port == port); + module->remove_port(port); + port->hide(); + if (module->num_ports() == 0) { patchage->canvas()->remove_item(module); module.reset(); + } else { + module->resize(); } + } else { cerr << "Unable to find port to destroy" << endl; } |