diff options
author | David Robillard <d@drobilla.net> | 2007-02-08 03:56:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-08 03:56:42 +0000 |
commit | 1359e05f9864bf420095347e46531628d1e3d683 (patch) | |
tree | cbfea845591c759c6b73abb14cf4e85ed72eb905 /src/JackDriver.cpp | |
parent | 37d05ae902f1fd6ce4c243e84502b0567990058f (diff) | |
download | patchage-1359e05f9864bf420095347e46531628d1e3d683.tar.gz patchage-1359e05f9864bf420095347e46531628d1e3d683.tar.bz2 patchage-1359e05f9864bf420095347e46531628d1e3d683.zip |
Circular nodes in FlowCanvas, related necessary redesign work and changes for API update.
Beginnings of a Machina GUI.
git-svn-id: http://svn.drobilla.net/lad/patchage@290 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/JackDriver.cpp')
-rw-r--r-- | src/JackDriver.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/JackDriver.cpp b/src/JackDriver.cpp index 3b35bd1..3f2920c 100644 --- a/src/JackDriver.cpp +++ b/src/JackDriver.cpp @@ -23,6 +23,7 @@ #include <jack/jack.h> #include <jack/statistics.h> #include <jack/thread.h> +#include <raul/SharedPtr.h> #include "PatchageFlowCanvas.h" #include "PatchageEvent.h" #include "JackDriver.h" @@ -113,18 +114,21 @@ JackDriver::detach() void JackDriver::destroy_all_ports() { - ModuleMap modules = _app->canvas()->modules(); // copy - for (ModuleMap::iterator m = modules.begin(); m != modules.end(); ++m) { - PortVector ports = m->second->ports(); // copy + ItemMap modules = _app->canvas()->items(); // copy + for (ItemMap::iterator m = modules.begin(); m != modules.end(); ++m) { + SharedPtr<Module> module = PtrCast<Module>(m->second); + if (!module) + continue; + PortVector ports = module->ports(); // copy for (PortVector::iterator p = ports.begin(); p != ports.end(); ++p) { boost::shared_ptr<PatchagePort> port = boost::dynamic_pointer_cast<PatchagePort>(*p); if (port && port->type() == JACK_AUDIO || port->type() == JACK_MIDI) { - m->second->remove_port(port); + module->remove_port(port); } } - if (m->second->ports().empty()) - _app->canvas()->remove_module(m->second->name()); + if (module->ports().empty()) + _app->canvas()->remove_item(module->name()); } } @@ -211,7 +215,7 @@ JackDriver::refresh() m = boost::shared_ptr<PatchageModule>(new PatchageModule(_app, client1_name, type)); m->load_location(); m->store_location(); - _app->canvas()->add_module(m); + _app->canvas()->add_item(m); } // FIXME: leak? jack docs don't say @@ -242,7 +246,7 @@ JackDriver::refresh() const string module_name = (*i).substr(0, i->find(":")); const string port_name = (*i).substr(i->find(":")+1); - for (ModuleMap::iterator m = _app->canvas()->modules().begin(); m != _app->canvas()->modules().end(); ++m) { + 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); } |