summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/OmFlowCanvas.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-07-03 18:28:10 +0000
committerDavid Robillard <d@drobilla.net>2006-07-03 18:28:10 +0000
commit2df7c1a1e805bea3d439d345d37469a8d202a656 (patch)
tree4c3f0ebb6928b1f3437b6708ffc0ab7873756a6f /src/progs/ingenuity/OmFlowCanvas.cpp
parent0aaae8b002fcff9fdd81a6155c609a546f68b938 (diff)
downloadingen-2df7c1a1e805bea3d439d345d37469a8d202a656.tar.gz
ingen-2df7c1a1e805bea3d439d345d37469a8d202a656.tar.bz2
ingen-2df7c1a1e805bea3d439d345d37469a8d202a656.zip
Creating of multiple patch input/output ports
git-svn-id: http://svn.drobilla.net/lad/ingen@80 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/OmFlowCanvas.cpp')
-rw-r--r--src/progs/ingenuity/OmFlowCanvas.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/progs/ingenuity/OmFlowCanvas.cpp b/src/progs/ingenuity/OmFlowCanvas.cpp
index 57b66998..fc9ec9ef 100644
--- a/src/progs/ingenuity/OmFlowCanvas.cpp
+++ b/src/progs/ingenuity/OmFlowCanvas.cpp
@@ -172,10 +172,27 @@ OmFlowCanvas::destroy_selected()
}
+string
+OmFlowCanvas::generate_port_name(const string& base) {
+ string name = base;
+
+ char num_buf[5];
+ for (uint i=1; i < 9999; ++i) {
+ snprintf(num_buf, 5, "%d", i);
+ name = base + "_";
+ name += num_buf;
+ if (!m_patch_controller->patch_model()->get_port(name))
+ break;
+ }
+
+ return name;
+}
+
+
void
OmFlowCanvas::menu_add_port(const string& name, const string& type, bool is_output)
{
- const Path& path = m_patch_controller->path().base_path() + name;
+ const Path& path = m_patch_controller->path().base_path() + generate_port_name(name);
Controller::instance().create_port(path, type, is_output);
char temp_buf[16];
@@ -184,6 +201,8 @@ OmFlowCanvas::menu_add_port(const string& name, const string& type, bool is_outp
snprintf(temp_buf, 16, "%d", m_last_click_y);
Controller::instance().set_metadata(path, "module-y", temp_buf);
}
+
+
/*
void
OmFlowCanvas::menu_add_audio_input()