diff options
Diffstat (limited to 'src/progs/ingenuity')
-rw-r--r-- | src/progs/ingenuity/ControlPanel.cpp | 5 | ||||
-rw-r--r-- | src/progs/ingenuity/NodeControlWindow.cpp | 1 | ||||
-rw-r--r-- | src/progs/ingenuity/NodeControlWindow.h | 4 | ||||
-rw-r--r-- | src/progs/ingenuity/NodeController.cpp | 46 | ||||
-rw-r--r-- | src/progs/ingenuity/NodeController.h | 1 | ||||
-rw-r--r-- | src/progs/ingenuity/OmFlowCanvas.cpp | 4 | ||||
-rw-r--r-- | src/progs/ingenuity/OmFlowCanvas.h | 2 | ||||
-rw-r--r-- | src/progs/ingenuity/OmModule.h | 2 | ||||
-rw-r--r-- | src/progs/ingenuity/OmPort.cpp | 2 | ||||
-rw-r--r-- | src/progs/ingenuity/OmPort.h | 2 | ||||
-rw-r--r-- | src/progs/ingenuity/OmPortModule.h | 5 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchController.cpp | 183 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchController.h | 2 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchTreeWindow.cpp | 17 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchTreeWindow.h | 9 | ||||
-rw-r--r-- | src/progs/ingenuity/PortController.cpp | 69 | ||||
-rw-r--r-- | src/progs/ingenuity/PortController.h | 13 | ||||
-rw-r--r-- | src/progs/ingenuity/SubpatchModule.cpp | 12 | ||||
-rw-r--r-- | src/progs/ingenuity/SubpatchModule.h | 2 |
19 files changed, 159 insertions, 222 deletions
diff --git a/src/progs/ingenuity/ControlPanel.cpp b/src/progs/ingenuity/ControlPanel.cpp index 0841a818..57ac7824 100644 --- a/src/progs/ingenuity/ControlPanel.cpp +++ b/src/progs/ingenuity/ControlPanel.cpp @@ -222,11 +222,6 @@ void ControlPanel::value_changed(const Path& port_path, float val) { if (m_callback_enabled) { - // Update patch control slider, if this is a control panel for a patch - // (or vice versa) - //if (m_mirror != NULL) - // m_mirror->set_port_value(port_path, val); - if (m_all_voices_radio->get_active()) { App::instance().engine()->set_port_value(port_path, val); } else { diff --git a/src/progs/ingenuity/NodeControlWindow.cpp b/src/progs/ingenuity/NodeControlWindow.cpp index 21afd234..3af8f834 100644 --- a/src/progs/ingenuity/NodeControlWindow.cpp +++ b/src/progs/ingenuity/NodeControlWindow.cpp @@ -18,6 +18,7 @@ #include "GladeFactory.h" #include "NodeController.h" #include "ControlGroups.h" +#include "ControlPanel.h" #include "PatchWindow.h" #include <iostream> #include <cmath> diff --git a/src/progs/ingenuity/NodeControlWindow.h b/src/progs/ingenuity/NodeControlWindow.h index dbc1aa49..b30223d7 100644 --- a/src/progs/ingenuity/NodeControlWindow.h +++ b/src/progs/ingenuity/NodeControlWindow.h @@ -23,15 +23,13 @@ #include <gtkmm.h> #include <libglademm.h> #include <sigc++/sigc++.h> -#include "ControlPanel.h" using std::string; using std::vector; -using namespace Ingen::Client; - namespace Ingenuity { class ControlGroup; class NodeController; +class ControlPanel; /** Window with controls (sliders) for all control-rate ports on a Node. diff --git a/src/progs/ingenuity/NodeController.cpp b/src/progs/ingenuity/NodeController.cpp index 331a714e..1c340516 100644 --- a/src/progs/ingenuity/NodeController.cpp +++ b/src/progs/ingenuity/NodeController.cpp @@ -97,31 +97,42 @@ NodeController::NodeController(CountedPtr<NodeModel> model) NodeController::~NodeController() { + destroy_module(); } void NodeController::create_module(OmFlowCanvas* canvas) { - //cerr << "Creating node module " << m_model->path() << endl; - - // If this is a DSSI plugin, DSSIController should be doing this - /*assert(node_model()->plugin()); - assert(node_model()->plugin()->type() != PluginModel::DSSI); - assert(canvas != NULL); - assert(m_module == NULL);*/ - - assert(canvas); - assert(node_model()); - m_module = new OmModule(canvas, this); - - create_all_ports(); + if (!m_module || m_module->canvas() != canvas) { + delete m_module; + //cerr << "Creating node module " << m_model->path() << endl; + + // If this is a DSSI plugin, DSSIController should be doing this + /*assert(node_model()->plugin()); + assert(node_model()->plugin()->type() != PluginModel::DSSI); + assert(canvas != NULL); + assert(m_module == NULL);*/ + + assert(canvas); + assert(node_model()); + m_module = new OmModule(canvas, this); + create_all_ports(); + } m_module->move_to(node_model()->x(), node_model()->y()); } void +NodeController::destroy_module() +{ + delete m_module; + m_module = NULL; +} + + +void NodeController::set_path(const Path& new_path) { cerr << "FIXME: rename\n"; @@ -214,12 +225,6 @@ NodeController::add_port(CountedPtr<PortModel> pm) if (has_control_inputs()) enable_controls_menuitem(); } - - if (m_control_window != NULL) { - assert(m_control_window->control_panel() != NULL); - m_control_window->control_panel()->add_port(pc); - m_control_window->resize(); - } } @@ -233,8 +238,7 @@ NodeController::show_control_window() if (!m_control_window) m_control_window = new NodeControlWindow(this, poly); - if (m_control_window->control_panel()->num_controls() > 0) - m_control_window->present(); + m_control_window->present(); } diff --git a/src/progs/ingenuity/NodeController.h b/src/progs/ingenuity/NodeController.h index ca00087c..84ac09cd 100644 --- a/src/progs/ingenuity/NodeController.h +++ b/src/progs/ingenuity/NodeController.h @@ -57,6 +57,7 @@ public: virtual void metadata_update(const string& key, const string& value); virtual void create_module(OmFlowCanvas* canvas); + virtual void destroy_module(); void set_path(const Path& new_path); diff --git a/src/progs/ingenuity/OmFlowCanvas.cpp b/src/progs/ingenuity/OmFlowCanvas.cpp index ac5f8beb..a6e3617e 100644 --- a/src/progs/ingenuity/OmFlowCanvas.cpp +++ b/src/progs/ingenuity/OmFlowCanvas.cpp @@ -179,13 +179,15 @@ OmFlowCanvas::generate_port_name(const string& base) { char num_buf[5]; for (uint i=1; i < 9999; ++i) { - snprintf(num_buf, 5, "%d", i); + snprintf(num_buf, 5, "%u", i); name = base + "_"; name += num_buf; if (!m_patch_controller->patch_model()->get_port(name)) break; } + assert(Path::is_valid(string("/") + name)); + return name; } diff --git a/src/progs/ingenuity/OmFlowCanvas.h b/src/progs/ingenuity/OmFlowCanvas.h index 310aa5b8..7db347f7 100644 --- a/src/progs/ingenuity/OmFlowCanvas.h +++ b/src/progs/ingenuity/OmFlowCanvas.h @@ -41,7 +41,7 @@ public: OmFlowCanvas(PatchController* controller, int width, int height); OmModule* find_module(const string& name) - { return (OmModule*)FlowCanvas::find_module(name); } + { return (OmModule*)FlowCanvas::get_module(name); } void connect(const Port* src_port, const Port* dst_port); void disconnect(const Port* src_port, const Port* dst_port); diff --git a/src/progs/ingenuity/OmModule.h b/src/progs/ingenuity/OmModule.h index fcf94191..2a31a84f 100644 --- a/src/progs/ingenuity/OmModule.h +++ b/src/progs/ingenuity/OmModule.h @@ -52,7 +52,7 @@ public: virtual ~OmModule() {} virtual OmPort* port(const string& port_name) { - return (OmPort*)Module::port(port_name); + return (OmPort*)Module::get_port(port_name); } virtual void store_location(); diff --git a/src/progs/ingenuity/OmPort.cpp b/src/progs/ingenuity/OmPort.cpp index 12607f24..69406b97 100644 --- a/src/progs/ingenuity/OmPort.cpp +++ b/src/progs/ingenuity/OmPort.cpp @@ -28,7 +28,7 @@ using namespace Ingen::Client; namespace Ingenuity { -OmPort::OmPort(OmModule* module, CountedPtr<PortModel> pm) +OmPort::OmPort(Module* module, CountedPtr<PortModel> pm) : Port(module, pm->name(), pm->is_input(), App::instance().configuration()->get_port_color(pm.get())), m_port_model(pm) { diff --git a/src/progs/ingenuity/OmPort.h b/src/progs/ingenuity/OmPort.h index d5021d79..5ffd4e26 100644 --- a/src/progs/ingenuity/OmPort.h +++ b/src/progs/ingenuity/OmPort.h @@ -42,7 +42,7 @@ class OmModule; class OmPort : public LibFlowCanvas::Port { public: - OmPort(OmModule* module, CountedPtr<PortModel> pm); + OmPort(Module* module, CountedPtr<PortModel> pm); virtual ~OmPort() {} diff --git a/src/progs/ingenuity/OmPortModule.h b/src/progs/ingenuity/OmPortModule.h index 19c72609..85bd349b 100644 --- a/src/progs/ingenuity/OmPortModule.h +++ b/src/progs/ingenuity/OmPortModule.h @@ -39,10 +39,9 @@ class OmFlowCanvas; class OmPort; -/** A module in a patch. +/** A "module" to represent a patch's port on it's own canvas. * - * This base class is extended for various types of modules - SubpatchModule, - * DSSIModule, etc. + * Translation: This is the nameless single port pseudo module thingy. * * \ingroup Ingenuity */ diff --git a/src/progs/ingenuity/PatchController.cpp b/src/progs/ingenuity/PatchController.cpp index 86e548c7..84c6eb7b 100644 --- a/src/progs/ingenuity/PatchController.cpp +++ b/src/progs/ingenuity/PatchController.cpp @@ -188,9 +188,9 @@ PatchController::set_path(const Path& new_path) for (NodeModelMap::const_iterator i = patch_model()->nodes().begin(); i != patch_model()->nodes().end(); ++i) { const NodeModel* const nm = (*i).second.get(); - assert(nm != NULL); + assert(nm ); NodeController* const nc = ((NodeController*)nm->controller()); - assert(nc != NULL); + assert(nc ); nc->set_path(new_path.base_path() + nc->node_model()->name()); } @@ -199,29 +199,26 @@ PatchController::set_path(const Path& new_path) for (PortModelList::const_iterator i = node_model()->ports().begin(); i != node_model()->ports().end(); ++i) { GtkObjectController* const pc = (GtkObjectController*)((*i)->controller()); - assert(pc != NULL); + assert(pc ); assert(pc->path().parent()== new_path); } #endif App::instance().patch_tree()->patch_renamed(old_path, new_path); - if (m_window != NULL) + if (m_window) m_window->patch_renamed(new_path); - if (m_control_window != NULL) + if (m_control_window) m_control_window->set_title(new_path + " Controls"); - if (m_module != NULL) { - assert(m_module->canvas() != NULL); - m_module->canvas()->rename_module(old_path.name(), new_path.name()); - assert(m_module->name() == new_path.name()); - } + if (m_module) + m_module->name(new_path.name()); PatchController* parent = dynamic_cast<PatchController*>( patch_model()->parent()->controller()); - if (parent != NULL && parent->window() != NULL) + if (parent && parent->window()) parent->window()->node_renamed(old_path, new_path); //remove_from_store(); @@ -232,54 +229,33 @@ PatchController::set_path(const Path& new_path) parent->patch_model()->rename_node(old_path, new_path); } -#if 0 -void -PatchController::enable() -{ - if (m_patch_view != NULL) - m_patch_view->enabled(true); - - patch_model()->enabled(true); - - App::instance().patch_tree()->patch_enabled(m_model->path()); -} - - -void -PatchController::disable() -{ - if (m_patch_view != NULL) - m_patch_view->enabled(false); - - patch_model()->enabled(false); - - App::instance().patch_tree()->patch_disabled(m_model->path()); -} -#endif void PatchController::create_module(OmFlowCanvas* canvas) { - //cerr << "Creating patch module " << m_model->path() << endl; + // Update menu if we didn't used to have a module + if (!m_module) { + /*Gtk::Menu::MenuList& items = m_menu.items(); + m_menu.remove(items[4]); + + items.push_front(Gtk::Menu_Helpers::SeparatorElem()); + items.push_front(Gtk::Menu_Helpers::MenuElem("Browse to Patch", + sigc::mem_fun((SubpatchModule*)m_module, &SubpatchModule::browse_to_patch))); + items.push_front(Gtk::Menu_Helpers::MenuElem("Open Patch in New Window", + sigc::mem_fun(this, &PatchController::show_patch_window)));*/ + } - assert(canvas != NULL); - assert(m_module == NULL); - assert(!m_patch_view || canvas != m_patch_view->canvas()); - - m_module = new SubpatchModule(canvas, this); + if (!m_module || m_module->canvas() != canvas) { + //cerr << "Creating patch module " << m_model->path() << endl; - m_menu.remove(m_menu.items()[4]); + assert(canvas != NULL); + assert(m_module == NULL); + assert(!m_patch_view || canvas != m_patch_view->canvas()); - // Add navigation menu items - Gtk::Menu::MenuList& items = m_menu.items(); - items.push_front(Gtk::Menu_Helpers::SeparatorElem()); - items.push_front(Gtk::Menu_Helpers::MenuElem("Browse to Patch", - sigc::mem_fun((SubpatchModule*)m_module, &SubpatchModule::browse_to_patch))); - items.push_front(Gtk::Menu_Helpers::MenuElem("Open Patch in New Window", - sigc::mem_fun(this, &PatchController::show_patch_window))); - - create_all_ports(); + m_module = new SubpatchModule(canvas, this); + create_all_ports(); + } m_module->move_to(node_model()->x(), node_model()->y()); } @@ -325,10 +301,8 @@ PatchController::create_view() assert(nc); assert(nm->controller() == nc); - if (nc->module() == NULL); - nc->create_module(m_patch_view->canvas()); - assert(nc->module() != NULL); - m_patch_view->canvas()->add_module(nc->module()); + nc->create_module(m_patch_view->canvas()); + assert(nc->module()); } // Create pseudo modules for ports (ports on this canvas, not on our module) @@ -336,18 +310,14 @@ PatchController::create_view() i != patch_model()->ports().end(); ++i) { PortController* const pc = dynamic_cast<PortController*>((*i)->controller()); assert(pc); - if (pc->module() == NULL) - pc->create_module(m_patch_view->canvas()); - assert(pc->module() != NULL); - m_patch_view->canvas()->add_module(pc->module()); - pc->module()->resize(); + pc->create_module(m_patch_view->canvas()); } // Create connections for (list<CountedPtr<ConnectionModel> >::const_iterator i = patch_model()->connections().begin(); i != patch_model()->connections().end(); ++i) { - create_connection(*i); + connection(*i); } // Set run checkbox @@ -373,24 +343,28 @@ PatchController::show_properties_window() /** Create a connection in the view (canvas). */ void -PatchController::create_connection(CountedPtr<ConnectionModel> cm) +PatchController::connection(CountedPtr<ConnectionModel> cm) { - // Deal with messy anonymous nodes for this patch's own ports... - const Path& src_parent_path = cm->src_port_path().parent(); - const Path& dst_parent_path = cm->dst_port_path().parent(); - - const string& src_parent_name = - (src_parent_path == path()) ? "" : src_parent_path.name(); - const string& dst_parent_name = - (dst_parent_path == path()) ? "" : dst_parent_path.name(); - - m_patch_view->canvas()->add_connection( - src_parent_name, - cm->src_port_path().name(), - dst_parent_name, - cm->dst_port_path().name()); + if (m_patch_view != NULL) { + + // Deal with port "anonymous nodes" for this patch's own ports... + const Path& src_parent_path = cm->src_port_path().parent(); + const Path& dst_parent_path = cm->dst_port_path().parent(); + + const string& src_parent_name = + (src_parent_path == path()) ? "" : src_parent_path.name(); + const string& dst_parent_name = + (dst_parent_path == path()) ? "" : dst_parent_path.name(); + + Port* src_port = m_patch_view->canvas()->get_port(src_parent_name, cm->src_port_path().name()); + Port* dst_port = m_patch_view->canvas()->get_port(dst_parent_name, cm->dst_port_path().name()); + assert(src_port && dst_port); + + m_patch_view->canvas()->add_connection(src_port, dst_port); + } } + NodeController* PatchController::create_controller_for_node(CountedPtr<NodeModel> node) { @@ -435,7 +409,6 @@ PatchController::add_node(CountedPtr<NodeModel> object) CountedPtr<NodeModel> node(object); - assert(node == object); if (node) { assert(node->parent() == m_patch_model); @@ -454,10 +427,8 @@ PatchController::add_node(CountedPtr<NodeModel> object) if (old_zoom != 1.0) m_patch_view->canvas()->zoom(1.0); - if (nc->module() == NULL) - nc->create_module(m_patch_view->canvas()); - assert(nc->module() != NULL); - m_patch_view->canvas()->add_module(nc->module()); + nc->create_module(m_patch_view->canvas()); + assert(nc->module()); nc->module()->resize(); // Reset zoom @@ -480,13 +451,8 @@ PatchController::remove_node(const string& name) assert(!m_patch_model->get_node(name)); // Update breadcrumbs if necessary - if (m_window != NULL) + if (m_window) m_window->node_removed(name); - - if (m_patch_view != NULL) { - assert(m_patch_view->canvas() != NULL); - m_patch_view->canvas()->remove_module(name); - } } @@ -534,11 +500,7 @@ PatchController::add_port(CountedPtr<PortModel> pm) if (old_zoom != 1.0) m_patch_view->canvas()->zoom(1.0); - if (pc->module() == NULL) - pc->create_module(m_patch_view->canvas()); - assert(pc->module() != NULL); - m_patch_view->canvas()->add_module(pc->module()); - pc->module()->resize(); + pc->create_module(m_patch_view->canvas()); // Reset zoom if (old_zoom != 1.0) { @@ -565,6 +527,7 @@ void PatchController::remove_port(const Path& path, bool resize_module) { assert(path.parent() == m_model->path()); + assert( ! patch_model()->get_port(path.name())); //cerr << "[PatchController] Removing port " << path << endl; @@ -577,16 +540,12 @@ PatchController::remove_port(const Path& path, bool resize_module) } }*/ - // Remove port on module - if (m_module != NULL) { - assert(m_module->port(path.name()) != NULL); - m_module->remove_port(path.name(), resize_module); - assert(m_module->port(path.name()) == NULL); + if (m_module) { + delete m_module->port(path.name()); + if (resize_module) + m_module->resize(); } - patch_model()->remove_port(path); - assert(patch_model()->get_port(path.name())); - // Disable "Controls" menuitem on module and patch window, if necessary if (!has_control_inputs()) disable_controls_menuitem(); @@ -594,19 +553,6 @@ PatchController::remove_port(const Path& path, bool resize_module) void -PatchController::connection(CountedPtr<ConnectionModel> cm) -{ - assert(cm); - - //patch_model()->add_connection(cm); - - if (m_patch_view != NULL) - create_connection(cm); -} - - - -void PatchController::disconnection(const Path& src_port_path, const Path& dst_port_path) { const string& src_node_name = src_port_path.parent().name(); @@ -614,9 +560,14 @@ PatchController::disconnection(const Path& src_port_path, const Path& dst_port_p const string& dst_node_name = dst_port_path.parent().name(); const string& dst_port_name = dst_port_path.name(); - if (m_patch_view != NULL) - m_patch_view->canvas()->remove_connection( - src_node_name, src_port_name, dst_node_name, dst_port_name); + if (m_patch_view) { + Port* src_port = m_patch_view->canvas()->get_port(src_node_name, src_port_name); + Port* dst_port = m_patch_view->canvas()->get_port(dst_node_name, dst_port_name); + + if (src_port && dst_port) { + m_patch_view->canvas()->remove_connection(src_port, dst_port); + } + } //patch_model()->remove_connection(src_port_path, dst_port_path); diff --git a/src/progs/ingenuity/PatchController.h b/src/progs/ingenuity/PatchController.h index ef8a438e..a5370826 100644 --- a/src/progs/ingenuity/PatchController.h +++ b/src/progs/ingenuity/PatchController.h @@ -109,8 +109,6 @@ private: void add_node(CountedPtr<NodeModel> object); void remove_node(const string& name); - void create_connection(CountedPtr<ConnectionModel> cm); - NodeController* create_controller_for_node(CountedPtr<NodeModel> node); PatchPropertiesWindow* m_properties_window; diff --git a/src/progs/ingenuity/PatchTreeWindow.cpp b/src/progs/ingenuity/PatchTreeWindow.cpp index 47bfc485..0f8c947a 100644 --- a/src/progs/ingenuity/PatchTreeWindow.cpp +++ b/src/progs/ingenuity/PatchTreeWindow.cpp @@ -20,6 +20,7 @@ #include "PatchTreeWindow.h" #include "PatchController.h" #include "PatchWindow.h" +#include "Store.h" #include "SubpatchModule.h" #include "PatchModel.h" #include "util/Path.h" @@ -64,6 +65,22 @@ PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject, void +PatchTreeWindow::init(Store& store) +{ + store.new_object_sig.connect(sigc::mem_fun(this, &PatchTreeWindow::new_object)); +} + + +void +PatchTreeWindow::new_object(CountedPtr<ObjectModel> object) +{ + CountedPtr<PatchModel> patch = object; + if (patch && dynamic_cast<PatchController*>(patch->controller())) + add_patch(dynamic_cast<PatchController*>(patch->controller())); +} + + +void PatchTreeWindow::add_patch(PatchController* pc) { const CountedPtr<PatchModel> pm = pc->patch_model(); diff --git a/src/progs/ingenuity/PatchTreeWindow.h b/src/progs/ingenuity/PatchTreeWindow.h index cdc7586a..a43703a7 100644 --- a/src/progs/ingenuity/PatchTreeWindow.h +++ b/src/progs/ingenuity/PatchTreeWindow.h @@ -21,6 +21,11 @@ #include <libglademm.h> #include "util/Path.h" +namespace Ingen { namespace Client { + class Store; +} } +using Ingen::Client::Store; + namespace Ingenuity { class PatchWindow; @@ -37,6 +42,10 @@ class PatchTreeWindow : public Gtk::Window public: PatchTreeWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); + void init(Store& store); + + void new_object(CountedPtr<ObjectModel> object); + void patch_enabled(const Path& path); void patch_disabled(const Path& path); void patch_renamed(const Path& old_path, const Path& new_path); diff --git a/src/progs/ingenuity/PortController.cpp b/src/progs/ingenuity/PortController.cpp index 0668a9e0..6a23169f 100644 --- a/src/progs/ingenuity/PortController.cpp +++ b/src/progs/ingenuity/PortController.cpp @@ -18,7 +18,7 @@ #include "OmFlowCanvas.h" #include "OmModule.h" #include "PortModel.h" -#include "ControlPanel.h" +#include "PatchModel.h" #include "OmPort.h" #include "OmPatchPort.h" #include "Store.h" @@ -28,9 +28,9 @@ namespace Ingenuity { PortController::PortController(CountedPtr<PortModel> model) : GtkObjectController(model), + m_patch_port(NULL), m_module(NULL), m_port(NULL) - //m_control_panel(NULL) { assert(model); assert(model->parent()); @@ -47,9 +47,6 @@ PortController::destroy() NodeController* parent = (NodeController*)m_model->parent()->controller(); assert(parent != NULL); - //if (m_control_panel != NULL) - // m_control_panel->remove_port(path()); - parent->remove_port(path(), false); } @@ -70,35 +67,38 @@ PortController::create_module(OmFlowCanvas* canvas) assert(canvas); assert(port_model()); + + if (m_module) + delete m_module; + m_module = new OmPortModule(canvas, this, x, y); - // FIXME: leak - m_patch_port = new OmPatchPort(m_module, port_model()); - m_module->add_port(m_patch_port, false); + if (CountedPtr<PatchModel>(port_model()->parent())) { + if (m_patch_port) + delete m_patch_port; + + m_patch_port = new OmPatchPort(m_module, port_model()); + } + m_module->resize(); + m_module->move_to(x, y); // FIXME: redundant (?) } void +PortController::destroy_module() +{ + delete m_module; + m_module = NULL; +} + + +void PortController::metadata_update(const string& key, const string& value) { - // FIXME: double lookups - - //cerr << path() << ": " << key << " = " << value << endl; - -/* Panel now listens to model signals.. - - if (key == "user-min") { - port_model()->user_min(atof(value.c_str())); - if (m_control_panel != NULL) - m_control_panel->set_range_min(m_model->path(), atof(value.c_str())); - } else if (key == "user-max") { - port_model()->user_max(atof(value.c_str())); - if (m_control_panel != NULL) - m_control_panel->set_range_max(m_model->path(), atof(value.c_str())); - } -*/ + //cerr << "Metadata " << path() << ": " << key << " = " << value << endl; + if (m_module != NULL) { if (key == "module-x") { float x = atof(value.c_str()); @@ -114,21 +114,6 @@ PortController::metadata_update(const string& key, const string& value) GtkObjectController::metadata_update(key, value); } - -/** "Register" a control panel that is monitoring this port. - * - * The OmPort will handle notifying the ControlPanel when state - * changes occur, etc. - */ -/* -void -PortController::set_control_panel(ControlPanel* cp) -{ - assert(m_control_panel == NULL); - m_control_panel = cp; -} -*/ - void PortController::set_path(const Path& new_path) { @@ -136,9 +121,6 @@ PortController::set_path(const Path& new_path) if (m_port != NULL) m_port->set_name(new_path.name()); - //if (m_control_panel != NULL) - // m_control_panel->rename_port(m_model->path(), new_path); - m_model->set_path(new_path); } @@ -152,8 +134,7 @@ PortController::create_port(OmModule* module) { assert(module != NULL); - m_port = new OmPort(module, port_model()); - module->add_port(m_port, false); + new OmPort(module, port_model()); } diff --git a/src/progs/ingenuity/PortController.h b/src/progs/ingenuity/PortController.h index 53c2cd48..1a58491b 100644 --- a/src/progs/ingenuity/PortController.h +++ b/src/progs/ingenuity/PortController.h @@ -35,7 +35,6 @@ namespace Ingenuity { class Controller; class OmPort; class OmPatchPort; -//class ControlPanel; class OmModule; class OmPortModule; class OmFlowCanvas; @@ -54,26 +53,22 @@ public: virtual void destroy(); virtual void create_module(OmFlowCanvas* canvas); + virtual void destroy_module(); OmPortModule* module() { return m_module; } -/* - virtual void add_to_store(); - virtual void remove_from_store(); -*/ + virtual void metadata_update(const string& key, const string& value); void create_port(OmModule* module); + void destroy_port(); + void set_path(const Path& new_path); - //ControlPanel* control_panel() const { return m_control_panel; } - //void set_control_panel(ControlPanel* cp); - CountedPtr<PortModel> port_model() const { return m_model; } private: OmPatchPort* m_patch_port; ///< Port on m_module OmPortModule* m_module; ///< Port pseudo-module (for patch ports only) OmPort* m_port; ///< Port on some other canvas module - //ControlPanel* m_control_panel; ///< Control panel that contains this port }; diff --git a/src/progs/ingenuity/SubpatchModule.cpp b/src/progs/ingenuity/SubpatchModule.cpp index 36fecff3..d0492618 100644 --- a/src/progs/ingenuity/SubpatchModule.cpp +++ b/src/progs/ingenuity/SubpatchModule.cpp @@ -41,18 +41,6 @@ SubpatchModule::SubpatchModule(OmFlowCanvas* canvas, PatchController* patch) void -SubpatchModule::add_om_port(PortModel* pm, bool resize_to_fit) -{ - OmPort* port = new OmPort(this, pm); - - port->signal_event().connect( - sigc::bind<Port*>(sigc::mem_fun(m_canvas, &OmFlowCanvas::port_event), port)); - - Module::add_port(port, resize_to_fit); -} - - -void SubpatchModule::on_double_click(GdkEventButton* event) { assert(m_patch != NULL); diff --git a/src/progs/ingenuity/SubpatchModule.h b/src/progs/ingenuity/SubpatchModule.h index 13d3d2f7..c530311e 100644 --- a/src/progs/ingenuity/SubpatchModule.h +++ b/src/progs/ingenuity/SubpatchModule.h @@ -49,8 +49,6 @@ public: SubpatchModule(OmFlowCanvas* canvas, PatchController* controller); virtual ~SubpatchModule() {} - void add_om_port(PortModel* pm, bool resize=true); - void on_double_click(GdkEventButton* ev); void show_dialog(); |