Disconnecting working in GTK client

git-svn-id: http://svn.drobilla.net/lad@33 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
dave 2006-06-12 17:40:20 +00:00
parent e1666be60f
commit 469a35b785
5 changed files with 25 additions and 4 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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";
/*