diff options
author | David Robillard <d@drobilla.net> | 2018-09-23 21:32:37 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-09-23 21:32:37 +0200 |
commit | 5d13ad11340a73214642245f4418aec9f197186d (patch) | |
tree | 801ffd9e2c32417dfb26d16db2cbcc0e6b52ef0c /src/gui | |
parent | 017982ff9d5d19d5524ebf010ea74540206c0f94 (diff) | |
download | ingen-5d13ad11340a73214642245f4418aec9f197186d.tar.gz ingen-5d13ad11340a73214642245f4418aec9f197186d.tar.bz2 ingen-5d13ad11340a73214642245f4418aec9f197186d.zip |
Fix copy/paste of ports
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GraphCanvas.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 37974d1e..931cc23f 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -734,12 +734,25 @@ GraphCanvas::paste() const URI& old_uri = path_to_uri(old_path); const Raul::Path& new_path = avoider.map_path(parent.child(node->path())); - Properties props{{uris.lv2_prototype, - _app.forge().make_urid(old_uri)}}; + // Copy properties, except those that should not be inherited in copies + Properties props = node->properties(); + for (const auto& prop : {uris.lv2_prototype, + uris.ingen_canvasX, + uris.ingen_canvasY, + uris.lv2_index, + uris.lv2_symbol}) { + props.erase(prop); + } + + // Store the old URI as a prototype (keeps provenance around) + props.emplace(uris.lv2_prototype, _app.forge().make_urid(old_uri)); - // Set the same types - const auto t = node->properties().equal_range(uris.rdf_type); - props.insert(t.first, t.second); + // Adjust numeric suffix on name if appropriate + auto n = props.find(uris.lv2_name); + if (n != props.end()) { + n->second = _app.forge().alloc(ClashAvoider::adjust_name( + old_path, new_path, n->second.ptr<char>())); + } // Set coordinates so paste origin is at the mouse pointer PropIter xi = node->properties().find(uris.ingen_canvasX); |