From e3600c6bd795fabff12faa4352bf3ba76b324222 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 12 Jun 2006 17:40:20 +0000 Subject: Disconnecting working in GTK client git-svn-id: http://svn.drobilla.net/lad/grauph@33 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/PatchModel.cpp | 2 +- src/libs/client/PatchModel.h | 5 +++-- src/libs/client/Store.cpp | 18 ++++++++++++++++++ src/libs/client/Store.h | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) (limited to 'src/libs/client') diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp index 877f5df0..90ffd38a 100644 --- a/src/libs/client/PatchModel.cpp +++ b/src/libs/client/PatchModel.cpp @@ -209,12 +209,12 @@ PatchModel::remove_connection(const string& src_port_path, const string& dst_por if (cm->src_port_path() == src_port_path && cm->dst_port_path() == dst_port_path) { m_connections.erase(i); // cuts our reference assert(!get_connection(src_port_path, dst_port_path)); // no duplicates + removed_connection_sig.emit(src_port_path, dst_port_path); return; } } cerr << "[PatchModel::remove_connection] WARNING: Failed to find connection " << src_port_path << " -> " << dst_port_path << endl; - return; } diff --git a/src/libs/client/PatchModel.h b/src/libs/client/PatchModel.h index 0f8dcd12..bc794d25 100644 --- a/src/libs/client/PatchModel.h +++ b/src/libs/client/PatchModel.h @@ -70,8 +70,9 @@ public: bool polyphonic() const; // Signals - sigc::signal > new_node_sig; - sigc::signal > new_connection_sig; + sigc::signal > new_node_sig; + sigc::signal > new_connection_sig; + sigc::signal removed_connection_sig; private: // Prevent copies (undefined) diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 21470f41..56c6654f 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -34,6 +34,7 @@ Store::Store(SigClientInterface& emitter) emitter.new_node_sig.connect(sigc::mem_fun(this, &Store::new_node_event)); emitter.new_port_sig.connect(sigc::mem_fun(this, &Store::new_port_event)); emitter.connection_sig.connect(sigc::mem_fun(this, &Store::connection_event)); + emitter.disconnection_sig.connect(sigc::mem_fun(this, &Store::disconnection_event)); emitter.metadata_update_sig.connect(sigc::mem_fun(this, &Store::metadata_update_event)); } @@ -292,5 +293,22 @@ Store::connection_event(const string& src_port_path, const string& dst_port_path } +void +Store::disconnection_event(const string& src_port_path, const string& dst_port_path) +{ + const Path& src = src_port_path; + const Path& dst = dst_port_path; + + assert(src.parent().parent() == dst.parent().parent()); + const Path& patch_path = src.parent().parent(); + + CountedPtr patch = this->patch(patch_path); + if (patch) + patch->remove_connection(src, dst); + else + cerr << "ERROR: connection in nonexistant patch" << endl; +} + + } // namespace LibOmClient diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h index b17d30c2..27850bcf 100644 --- a/src/libs/client/Store.h +++ b/src/libs/client/Store.h @@ -72,6 +72,7 @@ private: void new_port_event(const string& path, const string& data_type, bool is_output); void metadata_update_event(const string& subject_path, const string& predicate, const string& value); void connection_event(const string& src_port_path, const string& dst_port_path); + void disconnection_event(const string& src_port_path, const string& dst_port_path); map > m_objects; ///< Keyed by Om path map > m_plugins; ///< Keyed by URI -- cgit v1.2.1