diff options
author | David Robillard <d@drobilla.net> | 2011-12-04 07:25:09 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-12-04 07:25:09 +0000 |
commit | a9bea6c1d981d6bc53817fce6db4c9bc0f1e1e62 (patch) | |
tree | e1a98f16528a9f085774f824152e02c942646f9a /src/PatchageCanvas.cpp | |
parent | 314822117b6af5c2468f2a7772092591cd15044b (diff) | |
download | patchage-a9bea6c1d981d6bc53817fce6db4c9bc0f1e1e62.tar.gz patchage-a9bea6c1d981d6bc53817fce6db4c9bc0f1e1e62.tar.bz2 patchage-a9bea6c1d981d6bc53817fce6db4c9bc0f1e1e62.zip |
Move module ports down to C level.
Add STL-style port iteration API to Module.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@3795 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PatchageCanvas.cpp')
-rw-r--r-- | src/PatchageCanvas.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index 36b207d..d20add5 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -133,6 +133,16 @@ struct RemovePortsData { }; static void +delete_port_if_matches(FlowCanvasPort* port, void* cdata) +{ + RemovePortsData* data = (RemovePortsData*)cdata; + PatchagePort* pport = dynamic_cast<PatchagePort*>(Glib::wrap(port)); + if (pport && data->pred(pport)) { + delete pport; + } +} + +static void remove_ports_matching(FlowCanvasNode* node, void* cdata) { if (!FLOW_CANVAS_IS_MODULE(node)) { @@ -146,14 +156,8 @@ remove_ports_matching(FlowCanvasNode* node, void* cdata) } RemovePortsData* data = (RemovePortsData*)cdata; - - FlowCanvas::Module::Ports ports = pmodule->ports(); // copy - for (FlowCanvas::Module::Ports::iterator p = ports.begin(); - p != ports.end(); ++p) { - if (data->pred(dynamic_cast<PatchagePort*>(*p))) { - delete *p; - } - } + + pmodule->for_each_port(delete_port_if_matches, data); if (pmodule->num_ports() == 0) { data->empty.insert(pmodule); |