From cc384f6f622cc10fd83616256080b80dc2123aaf Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 14 Sep 2006 02:27:02 +0000 Subject: Cleaned up client-side model code significantly (made everything private so only Store can change the state of models). Extremely broken, just committing to move code between machines :). git-svn-id: http://svn.drobilla.net/lad/ingen@133 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/events/AddNodeEvent.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/libs/engine/events/AddNodeEvent.cpp') diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index 19ff6bf5..6e42ef82 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -33,7 +33,7 @@ namespace Ingen { -AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly) +/*AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly) : QueuedEvent(engine, responder, timestamp), m_path(path), m_plugin(plugin), @@ -43,12 +43,24 @@ AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr responder, Samp m_process_order(NULL), m_node_already_exists(false) { +}*/ + +AddNodeEvent::AddNodeEvent(Engine& engine, CountedPtr responder, SampleCount timestamp, const string& path, + const string& plugin_uri, bool poly) +: QueuedEvent(engine, responder, timestamp), + m_path(path), + m_plugin_uri(plugin_uri), + m_poly(poly), + m_patch(NULL), + m_node(NULL), + m_process_order(NULL), + m_node_already_exists(false) +{ } AddNodeEvent::~AddNodeEvent() { - delete m_plugin; } @@ -62,12 +74,13 @@ AddNodeEvent::pre_process() } m_patch = _engine.object_store()->find_patch(m_path.parent()); + const Plugin* plugin = _engine.node_factory()->plugin(m_plugin_uri); - if (m_patch != NULL) { + if (m_patch && plugin) { if (m_poly) - m_node = _engine.node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch); + m_node = _engine.node_factory()->load_plugin(plugin, m_path.name(), m_patch->internal_poly(), m_patch); else - m_node = _engine.node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch); + m_node = _engine.node_factory()->load_plugin(plugin, m_path.name(), 1, m_patch); if (m_node != NULL) { m_node->activate(); @@ -113,7 +126,7 @@ AddNodeEvent::post_process() } else if (m_node == NULL) { msg = "Unable to load node "; msg.append(m_path).append(" (you're missing the plugin \"").append( - m_plugin->uri()); + m_plugin_uri); _responder->respond_error(msg); } else { _responder->respond_ok(); -- cgit v1.2.1