diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/client/PatchModel.cpp | 2 | ||||
-rw-r--r-- | src/libs/client/PatchModel.h | 5 | ||||
-rw-r--r-- | src/libs/client/Store.cpp | 18 | ||||
-rw-r--r-- | src/libs/client/Store.h | 1 | ||||
-rw-r--r-- | src/progs/gtk/PatchController.cpp | 3 |
5 files changed, 25 insertions, 4 deletions
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<void, CountedPtr<NodeModel> > new_node_sig; - sigc::signal<void, CountedPtr<ConnectionModel> > new_connection_sig; + sigc::signal<void, CountedPtr<NodeModel> > new_node_sig; + sigc::signal<void, CountedPtr<ConnectionModel> > new_connection_sig; + sigc::signal<void, const string&, const string& > 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<PatchModel> 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<string, CountedPtr<ObjectModel> > m_objects; ///< Keyed by Om path map<string, CountedPtr<PluginModel> > m_plugins; ///< Keyed by URI diff --git a/src/progs/gtk/PatchController.cpp b/src/progs/gtk/PatchController.cpp index 4f639340..606cc65b 100644 --- a/src/progs/gtk/PatchController.cpp +++ b/src/progs/gtk/PatchController.cpp @@ -72,6 +72,7 @@ PatchController::PatchController(CountedPtr<PatchModel> model) model->new_node_sig.connect(sigc::mem_fun(this, &PatchController::add_node)); model->new_connection_sig.connect(sigc::mem_fun(this, &PatchController::connection)); + model->removed_connection_sig.connect(sigc::mem_fun(this, &PatchController::disconnection)); } @@ -599,7 +600,7 @@ PatchController::disconnection(const Path& src_port_path, const Path& dst_port_p m_patch_view->canvas()->remove_connection( src_node_name, src_port_name, dst_node_name, dst_port_name); - patch_model()->remove_connection(src_port_path, dst_port_path); + //patch_model()->remove_connection(src_port_path, dst_port_path); cerr << "FIXME: disconnection\n"; /* |