Subpatches working
git-svn-id: http://svn.drobilla.net/lad@39 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
parent
eea009cca8
commit
4846b3eea8
|
@ -86,15 +86,16 @@ public:
|
||||||
// Fail if this is not a valid cast
|
// Fail if this is not a valid cast
|
||||||
if (y) {
|
if (y) {
|
||||||
#ifdef WITH_RTTI
|
#ifdef WITH_RTTI
|
||||||
T* const unused_variable = dynamic_cast<T* const>(y._counter->ptr);
|
T* const casted_y = dynamic_cast<T* const>(y._counter->ptr);
|
||||||
#else
|
#else
|
||||||
T* const unused_variable = static_cast<T* const>(y._counter->ptr);
|
T* const casted_y = static_cast<T* const>(y._counter->ptr);
|
||||||
#endif
|
#endif
|
||||||
assert(unused_variable == y._counter->ptr); // shuts up gcc
|
if (casted_y != NULL) {
|
||||||
|
assert(casted_y == y._counter->ptr);
|
||||||
|
//release(); // FIXME: leak?
|
||||||
|
retain((Counter*)y._counter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//release();
|
|
||||||
retain((Counter*)y._counter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Assign to the value of a CountedPtr of the same type. */
|
/** Assign to the value of a CountedPtr of the same type. */
|
||||||
|
|
|
@ -187,6 +187,7 @@ NodeController::metadata_update(const string& key, const string& value)
|
||||||
|
|
||||||
if (m_bridge_port != NULL)
|
if (m_bridge_port != NULL)
|
||||||
m_bridge_port->metadata_update(key, value);
|
m_bridge_port->metadata_update(key, value);
|
||||||
|
|
||||||
GtkObjectController::metadata_update(key, value);
|
GtkObjectController::metadata_update(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,6 @@ PatchController::create_module(OmFlowCanvas* canvas)
|
||||||
create_all_ports();
|
create_all_ports();
|
||||||
|
|
||||||
m_module->move_to(node_model()->x(), node_model()->y());
|
m_module->move_to(node_model()->x(), node_model()->y());
|
||||||
m_module->store_location();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -388,93 +387,91 @@ PatchController::create_connection(CountedPtr<ConnectionModel> cm)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Add a subpatch to this patch.
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
PatchController::add_subpatch(PatchController* patch)
|
PatchController::add_node(CountedPtr<NodeModel> object)
|
||||||
{
|
|
||||||
assert(patch != NULL);
|
|
||||||
assert(patch->patch_model());
|
|
||||||
assert(patch->patch_model()->parent());
|
|
||||||
|
|
||||||
/*if (pm->x() == 0 && pm->y() == 0) {
|
|
||||||
int x, y;
|
|
||||||
parent_pc->get_new_module_location(x, y);
|
|
||||||
pm->x(x);
|
|
||||||
pm->y(y);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//patch_model()->add_node(patch->patch_model());
|
|
||||||
|
|
||||||
if (m_patch_view != NULL) {
|
|
||||||
patch->create_module(m_patch_view->canvas());
|
|
||||||
m_patch_view->canvas()->add_module(patch->module());
|
|
||||||
patch->module()->resize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PatchController::add_node(CountedPtr<NodeModel> nm)
|
|
||||||
{
|
{
|
||||||
cerr << "ADD NODE\n";
|
cerr << "ADD NODE\n";
|
||||||
|
|
||||||
assert(nm);
|
assert(object);
|
||||||
assert(nm->parent() == m_patch_model);
|
assert(object->parent() == m_patch_model);
|
||||||
assert(nm->path().parent() == m_patch_model->path());
|
assert(object->path().parent() == m_patch_model->path());
|
||||||
|
|
||||||
/*if (patch_model()->get_node(nm->name()) != NULL) {
|
/*if (patch_model()->get_node(nm->name()) != NULL) {
|
||||||
cerr << "Ignoring existing\n";
|
cerr << "Ignoring existing\n";
|
||||||
// Node already exists, ignore
|
// Node already exists, ignore
|
||||||
//delete nm;
|
//delete nm;
|
||||||
} else {*/
|
} else {*/
|
||||||
// FIXME: Should PatchController really be responsible for creating these?
|
|
||||||
|
|
||||||
|
CountedPtr<NodeModel> node(object);
|
||||||
|
if (node) {
|
||||||
|
cerr << "\tNode Child\n";
|
||||||
|
assert(node->parent() == m_patch_model);
|
||||||
|
|
||||||
NodeController* nc = NULL;
|
NodeController* nc = NULL;
|
||||||
|
|
||||||
if (nm->plugin() && nm->plugin()->type() == PluginModel::DSSI)
|
CountedPtr<PatchModel> patch(node);
|
||||||
nc = new DSSIController(nm);
|
if (patch) {
|
||||||
else
|
cerr << "\t.. is a Patch Child\n";
|
||||||
nc = new NodeController(nm);
|
assert(patch->parent() == m_patch_model);
|
||||||
|
|
||||||
|
nc = new PatchController(patch);
|
||||||
|
} else {
|
||||||
|
cerr << "\t... is a Plugin Node Child\n";
|
||||||
|
assert(node->plugin());
|
||||||
|
if (node->plugin()->type() == PluginModel::DSSI)
|
||||||
|
nc = new DSSIController(node);
|
||||||
|
else
|
||||||
|
nc = new NodeController(node);
|
||||||
|
}
|
||||||
|
|
||||||
assert(nc != NULL);
|
assert(nc != NULL);
|
||||||
assert(nm->controller() == nc);
|
assert(node->controller() == nc);
|
||||||
|
|
||||||
// Check if this is a bridge node - FIXME: remove this
|
// Check if this is a bridge node - FIXME: remove this
|
||||||
CountedPtr<PortModel> pm = patch_model()->get_port(nm->path().name());
|
CountedPtr<PortModel> pm = patch_model()->get_port(node->path().name());
|
||||||
if (pm) {
|
if (pm) {
|
||||||
cerr << "Bridge node." << endl;
|
cerr << "Bridge node." << endl;
|
||||||
PortController* pc = ((PortController*)pm->controller());
|
PortController* pc = ((PortController*)pm->controller());
|
||||||
assert(pc != NULL);
|
assert(pc != NULL);
|
||||||
nc->bridge_port(pc);
|
nc->bridge_port(pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//nc->add_to_store();
|
//nc->add_to_store();
|
||||||
//patch_model()->add_node(nm);
|
//patch_model()->add_node(node);
|
||||||
|
|
||||||
if (m_patch_view != NULL) {
|
if (m_patch_view != NULL) {
|
||||||
int x, y;
|
int x, y;
|
||||||
get_new_module_location(x, y);
|
get_new_module_location(x, y);
|
||||||
nm->x(x);
|
node->x(x);
|
||||||
nm->y(y);
|
node->y(y);
|
||||||
|
|
||||||
// Set zoom to 1.0 so module isn't messed up (Death to GnomeCanvas)
|
// Set zoom to 1.0 so module isn't messed up (Death to GnomeCanvas)
|
||||||
float old_zoom = m_patch_view->canvas()->zoom();
|
float old_zoom = m_patch_view->canvas()->zoom();
|
||||||
if (old_zoom != 1.0)
|
if (old_zoom != 1.0)
|
||||||
m_patch_view->canvas()->zoom(1.0);
|
m_patch_view->canvas()->zoom(1.0);
|
||||||
|
|
||||||
if (nc->module() == NULL)
|
if (nc->module() == NULL)
|
||||||
nc->create_module(m_patch_view->canvas());
|
nc->create_module(m_patch_view->canvas());
|
||||||
assert(nc->module() != NULL);
|
assert(nc->module() != NULL);
|
||||||
m_patch_view->canvas()->add_module(nc->module());
|
m_patch_view->canvas()->add_module(nc->module());
|
||||||
nc->module()->resize();
|
nc->module()->resize();
|
||||||
|
|
||||||
// Reset zoom
|
// Reset zoom
|
||||||
if (old_zoom != 1.0) {
|
if (old_zoom != 1.0) {
|
||||||
m_patch_view->canvas()->zoom(old_zoom);
|
m_patch_view->canvas()->zoom(old_zoom);
|
||||||
nc->module()->zoom(old_zoom);
|
nc->module()->zoom(old_zoom);
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*CountedPtr<PortModel> port(object);
|
||||||
|
if (port) {
|
||||||
|
cerr << "\tPort Child??\n";
|
||||||
|
//assert(port->parent() == m_patch_model);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,6 @@ public:
|
||||||
void disconnection(const Path& src_port_path, const Path& dst_port_path);
|
void disconnection(const Path& src_port_path, const Path& dst_port_path);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void add_subpatch(PatchController* patch);
|
|
||||||
|
|
||||||
void get_new_module_location(int& x, int& y);
|
void get_new_module_location(int& x, int& y);
|
||||||
|
|
||||||
void show_control_window();
|
void show_control_window();
|
||||||
|
@ -108,7 +106,7 @@ public:
|
||||||
void disable_controls_menuitem();
|
void disable_controls_menuitem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void add_node(CountedPtr<NodeModel> nm);
|
void add_node(CountedPtr<NodeModel> object);
|
||||||
void remove_node(const string& name);
|
void remove_node(const string& name);
|
||||||
|
|
||||||
void create_connection(CountedPtr<ConnectionModel> cm);
|
void create_connection(CountedPtr<ConnectionModel> cm);
|
||||||
|
|
Loading…
Reference in New Issue