From acbe9a26ec3ab689e430225d15e95e73a7378aa9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 7 Sep 2006 06:04:55 +0000 Subject: Patch port fixes. Port metadata fixes. Compatibility hacks for loading old patches. Internal node fixes, cleanups, minor refactor. Path fixes. git-svn-id: http://svn.drobilla.net/lad/ingen@118 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/ingenuity/PatchController.cpp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'src/progs/ingenuity/PatchController.cpp') diff --git a/src/progs/ingenuity/PatchController.cpp b/src/progs/ingenuity/PatchController.cpp index 79084cdc..49c7491c 100644 --- a/src/progs/ingenuity/PatchController.cpp +++ b/src/progs/ingenuity/PatchController.cpp @@ -313,8 +313,8 @@ PatchController::create_view() /* Set sane default coordinates if not set already yet */ if (nm->x() == 0.0f && nm->y() == 0.0f) { - int x, y; - get_new_module_location(x, y); + double x, y; + m_patch_view->canvas()->get_new_module_location(x, y); nm->x(x); nm->y(y); } @@ -338,7 +338,7 @@ PatchController::create_view() PortController* const pc = dynamic_cast((*i)->controller()); assert(pc); if (pc->module() == NULL) - pc->create_module(m_patch_view->canvas(), 1600, 1200); + pc->create_module(m_patch_view->canvas()); assert(pc->module() != NULL); m_patch_view->canvas()->add_module(pc->module()); pc->module()->resize(); @@ -471,8 +471,8 @@ PatchController::add_node(CountedPtr object) assert(node->controller() == nc); if (m_patch_view != NULL) { - int x, y; - get_new_module_location(x, y); + double x, y; + m_patch_view->canvas()->get_new_module_location(x, y); node->x(x); node->y(y); @@ -557,8 +557,6 @@ PatchController::add_port(CountedPtr pm) // Create port's (pseudo) module on this patch's canvas (if there is one) if (m_patch_view != NULL) { - int x, y; - get_new_module_location(x, y); // Set zoom to 1.0 so module isn't messed up (Death to GnomeCanvas) float old_zoom = m_patch_view->canvas()->zoom(); @@ -566,7 +564,7 @@ PatchController::add_port(CountedPtr pm) m_patch_view->canvas()->zoom(1.0); if (pc->module() == NULL) - pc->create_module(m_patch_view->canvas(), x, y); + pc->create_module(m_patch_view->canvas()); assert(pc->module() != NULL); m_patch_view->canvas()->add_module(pc->module()); pc->module()->resize(); @@ -662,20 +660,6 @@ PatchController::disconnection(const Path& src_port_path, const Path& dst_port_p */ } - -/** Try to guess a suitable location for a new module. - */ -void -PatchController::get_new_module_location(int& x, int& y) -{ - assert(m_patch_view != NULL); - assert(m_patch_view->canvas() != NULL); - m_patch_view->canvas()->get_scroll_offsets(x, y); - x += 20; - y += 20; -} - - void PatchController::show_patch_window() { -- cgit v1.2.1