From 190e2cf3c91f8bd5b1a6f69d00e84a108c743898 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 12 Jun 2006 00:41:00 +0000 Subject: Metadata working based on Store signals (node positions restored) git-svn-id: http://svn.drobilla.net/lad/grauph@29 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/gtk/GtkObjectController.cpp | 11 +---------- src/progs/gtk/GtkObjectController.h | 7 ++++++- src/progs/gtk/NodeController.cpp | 15 +++++++-------- 3 files changed, 14 insertions(+), 19 deletions(-) (limited to 'src/progs') diff --git a/src/progs/gtk/GtkObjectController.cpp b/src/progs/gtk/GtkObjectController.cpp index 49abe58f..241f123b 100644 --- a/src/progs/gtk/GtkObjectController.cpp +++ b/src/progs/gtk/GtkObjectController.cpp @@ -23,16 +23,7 @@ GtkObjectController::GtkObjectController(CountedPtr model) : m_model(model) { assert(m_model); -} - - -/** Derived classes should override this to handle special metadata - * keys, then call this to set the model's metadata key. - */ -void -GtkObjectController::metadata_update(const string& key, const string& value) -{ - m_model->set_metadata(key, value); + model->metadata_update_sig.connect(sigc::mem_fun(this, &GtkObjectController::metadata_update)); } diff --git a/src/progs/gtk/GtkObjectController.h b/src/progs/gtk/GtkObjectController.h index f80db6a4..77860a9c 100644 --- a/src/progs/gtk/GtkObjectController.h +++ b/src/progs/gtk/GtkObjectController.h @@ -58,7 +58,12 @@ public: virtual void add_to_store() = 0; virtual void remove_from_store() = 0; */ - virtual void metadata_update(const string& key, const string& value); + + /** Derived classes should override this to handle special metadata + * keys, then call this to set the model's metadata key. + */ + virtual void metadata_update(const string& key, const string& value) + { assert(m_model->get_metadata(key) != ""); } /** Rename object */ virtual void set_path(const Path& new_path) diff --git a/src/progs/gtk/NodeController.cpp b/src/progs/gtk/NodeController.cpp index 63994c00..7965c35a 100644 --- a/src/progs/gtk/NodeController.cpp +++ b/src/progs/gtk/NodeController.cpp @@ -50,12 +50,11 @@ NodeController::NodeController(CountedPtr model) model->set_controller(this); // Create port controllers - cerr << "FIXME: NodeController()" << endl; - /* - for (list::const_iterator i = node_model()->ports().begin(); + for (PortModelList::const_iterator i = node_model()->ports().begin(); i != node_model()->ports().end(); ++i) { - assert((*i)->controller() == NULL); + assert(!(*i)->controller()); assert((*i)->parent() == model.get()); + // FIXME: leak PortController* const pc = new PortController(*i); assert((*i)->controller() == pc); // PortController() does this } @@ -83,13 +82,12 @@ NodeController::NodeController(CountedPtr model) m_controls_menuitem->property_sensitive() = false; - if (node_model()->plugin()->type() == PluginModel::Internal + if (node_model()->plugin() && node_model()->plugin()->type() == PluginModel::Internal && node_model()->plugin()->plug_label() == "midi_control_in") { Gtk::Menu::MenuList& items = m_menu.items(); items.push_back(Gtk::Menu_Helpers::MenuElem("Learn", sigc::mem_fun(this, &NodeController::on_menu_learn))); } - */ model->new_port_sig.connect(sigc::mem_fun(this, &NodeController::add_port)); } @@ -227,11 +225,12 @@ NodeController::metadata_update(const string& key, const string& value) void NodeController::add_port(CountedPtr pm) { - assert(pm->parent() == NULL); + assert(pm->parent() == node_model().get()); + assert(node_model()->get_port(pm->name()) == pm); cout << "[NodeController] Adding port " << pm->path() << endl; - node_model()->add_port(pm); + // FIXME: leak PortController* pc = new PortController(pm); assert(pm->controller() == pc); //pc->add_to_store(); -- cgit v1.2.1