summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-17 23:00:34 +0000
committerDavid Robillard <d@drobilla.net>2008-08-17 23:00:34 +0000
commit14401d11e598651e7caf39cce884362e58ef5941 (patch)
tree05b2c57b1f55640149ba850a2f9f1fda175dccb8 /src/libs/client
parent9938fac4b15f8939c9056c16a3a7662575af52e1 (diff)
downloadingen-14401d11e598651e7caf39cce884362e58ef5941.tar.gz
ingen-14401d11e598651e7caf39cce884362e58ef5941.tar.bz2
ingen-14401d11e598651e7caf39cce884362e58ef5941.zip
Copy/paste of connections.
git-svn-id: http://svn.drobilla.net/lad/ingen@1426 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/ClientStore.cpp18
-rw-r--r--src/libs/client/ClientStore.hpp5
-rw-r--r--src/libs/client/PatchModel.cpp25
-rw-r--r--src/libs/client/PatchModel.hpp4
4 files changed, 12 insertions, 40 deletions
diff --git a/src/libs/client/ClientStore.cpp b/src/libs/client/ClientStore.cpp
index 6c2c81ff..b6477b1f 100644
--- a/src/libs/client/ClientStore.cpp
+++ b/src/libs/client/ClientStore.cpp
@@ -117,10 +117,13 @@ ClientStore::resolve_plugin_orphans(SharedPtr<PluginModel> plugin)
void
ClientStore::add_connection_orphan(std::pair<Path, Path> orphan)
{
- if (!_handle_orphans)
- return;
- cerr << "WARNING: Orphan connection " << orphan.first
- << " -> " << orphan.second << " received." << endl;
+ // Do this anyway, it's needed to get the connections for copy&paste
+ //if (!_handle_orphans)
+ //return;
+
+ if (_handle_orphans)
+ cerr << "WARNING: Orphan connection " << orphan.first
+ << " -> " << orphan.second << " received." << endl;
_connection_orphans.push_back(orphan);
}
@@ -587,9 +590,8 @@ ClientStore::attempt_connection(const Path& src_port_path, const Path& dst_port_
{
SharedPtr<PortModel> src_port = PtrCast<PortModel>(object(src_port_path));
SharedPtr<PortModel> dst_port = PtrCast<PortModel>(object(dst_port_path));
-
- if (src_port && dst_port) {
+ if (src_port && dst_port) {
assert(src_port->parent());
assert(dst_port->parent());
@@ -602,13 +604,9 @@ ClientStore::attempt_connection(const Path& src_port_path, const Path& dst_port_
dst_port->connected_to(src_port);
patch->add_connection(cm);
-
return true;
-
} else if (add_orphan) {
-
add_connection_orphan(make_pair(src_port_path, dst_port_path));
-
}
return false;
diff --git a/src/libs/client/ClientStore.hpp b/src/libs/client/ClientStore.hpp
index 4b4d9742..d904a3e3 100644
--- a/src/libs/client/ClientStore.hpp
+++ b/src/libs/client/ClientStore.hpp
@@ -79,6 +79,9 @@ public:
void set_voice_value(const string& port_path, uint32_t voice, const Raul::Atom& value);
void connect(const string& src_port_path, const string& dst_port_path);
void disconnect(const string& src_port_path, const string& dst_port_path);
+
+ typedef list< std::pair<Path, Path> > ConnectionRecords;
+ const ConnectionRecords& connection_records() { return _connection_orphans; }
sigc::signal<void, SharedPtr<ObjectModel> > signal_new_object;
sigc::signal<void, SharedPtr<PluginModel> > signal_new_plugin;
@@ -138,7 +141,7 @@ private:
Raul::PathTable<list<std::pair<string, Atom> > > _variable_orphans;
/** Ditto */
- list<std::pair<Path, Path> > _connection_orphans;
+ ConnectionRecords _connection_orphans;
};
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp
index 69365719..af20c9f8 100644
--- a/src/libs/client/PatchModel.cpp
+++ b/src/libs/client/PatchModel.cpp
@@ -186,30 +186,5 @@ PatchModel::polyphonic() const
}
-unsigned
-PatchModel::child_name_offset(ClientStore& store,
- SharedPtr<PatchModel> parent,
- const string& base_name)
-{
- assert(Path::is_valid_name(base_name));
- unsigned offset = 0;
-
- while (true) {
- std::stringstream ss;
- ss << base_name;
- if (offset > 0)
- ss << "_" << offset;
- if (store.find(parent->path().base() + ss.str()) == store.end())
- break;
- else if (offset == 0)
- offset = 2;
- else
- ++offset;
- }
-
- return offset;
-}
-
-
} // namespace Client
} // namespace Ingen
diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp
index b1c03cd0..70c8df0e 100644
--- a/src/libs/client/PatchModel.hpp
+++ b/src/libs/client/PatchModel.hpp
@@ -66,10 +66,6 @@ public:
virtual void set_property(const string& key, const Atom& value);
- static unsigned child_name_offset(ClientStore& store,
- SharedPtr<PatchModel> parent,
- const string& base_name);
-
// Signals
sigc::signal<void, SharedPtr<NodeModel> > signal_new_node;
sigc::signal<void, SharedPtr<NodeModel> > signal_removed_node;