summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-24 23:10:43 +0000
committerDavid Robillard <d@drobilla.net>2007-07-24 23:10:43 +0000
commit35b1c7c0683a72978f646c883f411e1eabd595ae (patch)
treeeff7d5e6048ed320916ec9a2f11768200361cec3 /src
parent560fac6a42644bd7584db5f53db19c936ef50ab0 (diff)
downloadpatchage-35b1c7c0683a72978f646c883f411e1eabd595ae.tar.gz
patchage-35b1c7c0683a72978f646c883f411e1eabd595ae.tar.bz2
patchage-35b1c7c0683a72978f646c883f411e1eabd595ae.zip
Possibly fix overlapping MIDI ports (fix ticket 10).
git-svn-id: http://svn.drobilla.net/lad/patchage@616 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/AlsaDriver.cpp4
-rw-r--r--src/JackDriver.cpp16
-rw-r--r--src/PatchageEvent.cpp9
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;
}