diff options
author | David Robillard <d@drobilla.net> | 2010-12-18 23:12:29 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-18 23:12:29 +0000 |
commit | dd0a8c156002e994050879abf527aea185512158 (patch) | |
tree | a8a5f8e507f705f40aa43eed71b0d850cbdf594b | |
parent | afac324970545893932b7de83f2605b1a5568909 (diff) | |
download | patchage-dd0a8c156002e994050879abf527aea185512158.tar.gz patchage-dd0a8c156002e994050879abf527aea185512158.tar.bz2 patchage-dd0a8c156002e994050879abf527aea185512158.zip |
Arrange interface input/output modules (and other split modules) beside each other sanely in Patchage (the way people typically do).
This makes auto-arrange vastly more useful and sane in Patchage, particularly when few things are connected.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2772 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/PatchageCanvas.cpp | 24 | ||||
-rw-r--r-- | src/PatchageCanvas.hpp | 6 | ||||
-rw-r--r-- | wscript | 2 |
3 files changed, 26 insertions, 6 deletions
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index dbeaf22..552f583 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -182,6 +182,29 @@ PatchageCanvas::status_message(const string& msg) _app->status_msg(string("[Canvas] ").append(msg)); } + +void +PatchageCanvas::add_module(const std::string& name, boost::shared_ptr<PatchageModule> module) +{ + _module_index.insert(std::make_pair(name, module)); + + // Join partners, if applicable + boost::shared_ptr<PatchageModule> in_module; + boost::shared_ptr<PatchageModule> out_module; + if (module->type() == Input) { + in_module = module; + out_module = find_module(name, Output); + } else if (module->type() == Output) { + in_module = find_module(name, Output); + out_module = module; + } + if (in_module && out_module) + out_module->set_partner(in_module); + + add_item(module); +} + + bool PatchageCanvas::remove_item(boost::shared_ptr<Item> i) { @@ -207,6 +230,7 @@ PatchageCanvas::remove_item(boost::shared_ptr<Item> i) return ret; } + void PatchageCanvas::destroy() { diff --git a/src/PatchageCanvas.hpp b/src/PatchageCanvas.hpp index 61321b7..c75af02 100644 --- a/src/PatchageCanvas.hpp +++ b/src/PatchageCanvas.hpp @@ -59,11 +59,7 @@ public: _port_index.insert(std::make_pair(id, port)); } - void add_module(const std::string& name, boost::shared_ptr<PatchageModule> module) { - _module_index.insert(std::make_pair(name, module)); - add_item(module); - } - + void add_module(const std::string& name, boost::shared_ptr<PatchageModule> module); bool remove_item(boost::shared_ptr<Item> i); void destroy(); @@ -49,7 +49,7 @@ def configure(conf): autowaf.check_pkg(conf, 'libglademm-2.4', uselib_store='GLADEMM', atleast_version='2.6.0', mandatory=True) autowaf.check_pkg(conf, 'flowcanvas', uselib_store='FLOWCANVAS', - atleast_version='0.7.0', mandatory=True) + atleast_version='0.7.1', mandatory=True) autowaf.check_pkg(conf, 'raul', uselib_store='RAUL', atleast_version='0.5.1', mandatory=True) |