summaryrefslogtreecommitdiffstats
path: root/src/PatchageCanvas.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-25 01:06:22 +0000
committerDavid Robillard <d@drobilla.net>2007-07-25 01:06:22 +0000
commit5837be3b45c83bd5743735de8cf451c5bdf3541d (patch)
tree3a0331f2a5391726efbb7b6362004a06050f50f1 /src/PatchageCanvas.cpp
parent35b1c7c0683a72978f646c883f411e1eabd595ae (diff)
downloadpatchage-5837be3b45c83bd5743735de8cf451c5bdf3541d.tar.gz
patchage-5837be3b45c83bd5743735de8cf451c5bdf3541d.tar.bz2
patchage-5837be3b45c83bd5743735de8cf451c5bdf3541d.zip
Avoid some canvas text measuring overhead in Patchage (module resizing).
Fix duplex Alsa Sequencer ports (fix ticket 12). git-svn-id: http://svn.drobilla.net/lad/patchage@617 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PatchageCanvas.cpp')
-rw-r--r--src/PatchageCanvas.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp
index 22b4d1f..ea4e371 100644
--- a/src/PatchageCanvas.cpp
+++ b/src/PatchageCanvas.cpp
@@ -62,19 +62,33 @@ PatchageCanvas::find_module(const string& name, ModuleType type)
#ifdef HAVE_ALSA
boost::shared_ptr<PatchagePort>
-PatchageCanvas::find_port(const snd_seq_addr_t* alsa_addr)
+PatchageCanvas::find_port(snd_seq_addr_t alsa_addr, bool input)
{
boost::shared_ptr<PatchagePort> pp;
for (ItemList::iterator m = _items.begin(); m != _items.end(); ++m) {
- SharedPtr<Module> module = PtrCast<Module>(*m);
+ SharedPtr<PatchageModule> module = PtrCast<PatchageModule>(*m);
if (!module)
continue;
+
for (PortVector::const_iterator p = module->ports().begin(); p != module->ports().end(); ++p) {
pp = boost::dynamic_pointer_cast<PatchagePort>(*p);
- if (pp && pp->type() == ALSA_MIDI && pp->alsa_addr()
- && pp->alsa_addr()->client == alsa_addr->client
- && pp->alsa_addr()->port == alsa_addr->port)
- return pp;
+ if (!pp)
+ continue;
+
+ if (pp->type() == ALSA_MIDI) {
+ /*cerr << "ALSA PORT: " << (int)pp->alsa_addr()->client << ":"
+ << (int)pp->alsa_addr()->port << endl;*/
+
+ if (pp->alsa_addr()
+ && pp->alsa_addr()->client == alsa_addr.client
+ && pp->alsa_addr()->port == alsa_addr.port) {
+ if (!input && module->type() == Input) {
+ //cerr << "WRONG DIRECTION, SKIPPED PORT" << endl;
+ } else {
+ return pp;
+ }
+ }
+ }
}
}