From a135a764751a356ac34c2f35f8ce2c009872f1fd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 15 Sep 2006 01:20:54 +0000 Subject: Fixed FlowCanvas #include directives (to include FLOWCANVAS prefix). Renamed classes/files in Ingenuity to make more sense (and kill "Om"). Patch port fixes. git-svn-id: http://svn.drobilla.net/lad/ingen@136 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/ingenuity/OmPortModule.cpp | 98 ------------------------------------ 1 file changed, 98 deletions(-) delete mode 100644 src/progs/ingenuity/OmPortModule.cpp (limited to 'src/progs/ingenuity/OmPortModule.cpp') diff --git a/src/progs/ingenuity/OmPortModule.cpp b/src/progs/ingenuity/OmPortModule.cpp deleted file mode 100644 index 7496a6a6..00000000 --- a/src/progs/ingenuity/OmPortModule.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "OmPortModule.h" -#include -#include "App.h" -#include "ModelEngineInterface.h" -#include "OmFlowCanvas.h" -#include "PatchModel.h" -#include "NodeModel.h" -#include "OmPort.h" -#include "GladeFactory.h" -#include "RenameWindow.h" -#include "PatchWindow.h" -#include "OmPatchPort.h" - -namespace Ingenuity { - - -OmPortModule::OmPortModule(OmFlowCanvas* canvas, CountedPtr port) -: LibFlowCanvas::Module(canvas, "", 0, 0), // FIXME: coords? - m_port(port), - m_patch_port(NULL) -{ - /*if (port_model()->polyphonic() && port_model()->parent() != NULL - && port_model()->parent_patch()->poly() > 1) { - border_width(2.0); - }*/ - - assert(canvas); - assert(port); - - if (PtrCast(port->parent())) { - if (m_patch_port) - delete m_patch_port; - - m_patch_port = new OmPatchPort(this, port); - } - - resize(); - - const Atom& x_atom = port->get_metadata("module-x"); - const Atom& y_atom = port->get_metadata("module-y"); - - if (x_atom && y_atom && x_atom.type() == Atom::FLOAT && y_atom.type() == Atom::FLOAT) { - move_to(x_atom.get_float(), y_atom.get_float()); - } else { - double default_x; - double default_y; - canvas->get_new_module_location(default_x, default_y); - move_to(default_x, default_y); - } - - port->metadata_update_sig.connect(sigc::mem_fun(this, &OmPortModule::metadata_update)); -} - - -void -OmPortModule::store_location() -{ - const float x = static_cast(property_x()); - const float y = static_cast(property_y()); - - const Atom& existing_x = m_port->get_metadata("module-x"); - const Atom& existing_y = m_port->get_metadata("module-y"); - - if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT - || existing_x.get_float() != x || existing_y.get_float() != y) { - App::instance().engine()->set_metadata(m_port->path(), "module-x", Atom(x)); - App::instance().engine()->set_metadata(m_port->path(), "module-y", Atom(y)); - } -} - - -void -OmPortModule::metadata_update(const string& key, const Atom& value) -{ - if (key == "module-x" && value.type() == Atom::FLOAT) - move_to(value.get_float(), property_y()); - else if (key == "module-y" && value.type() == Atom::FLOAT) - move_to(property_x(), value.get_float()); -} - - -} // namespace Ingenuity -- cgit v1.2.1