From 93850c202de8b073a1ce1dd8bd246d407bce4e2f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 30 Sep 2008 16:50:21 +0000 Subject: Flatten ingen source directory heirarchy a bit. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1551 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/PatchPortModule.cpp | 158 --------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 src/libs/gui/PatchPortModule.cpp (limited to 'src/libs/gui/PatchPortModule.cpp') diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp deleted file mode 100644 index d8aaa91d..00000000 --- a/src/libs/gui/PatchPortModule.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 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 -#include "PatchPortModule.hpp" -#include "interface/EngineInterface.hpp" -#include "client/PatchModel.hpp" -#include "client/NodeModel.hpp" -#include "App.hpp" -#include "PatchCanvas.hpp" -#include "Port.hpp" -#include "GladeFactory.hpp" -#include "RenameWindow.hpp" -#include "PatchWindow.hpp" -#include "WindowFactory.hpp" -#include "PortMenu.hpp" - -namespace Ingen { -namespace GUI { - - -PatchPortModule::PatchPortModule(boost::shared_ptr canvas, SharedPtr port) -: FlowCanvas::Module(canvas, port->path().name(), 0, 0, false), // FIXME: coords? - _port(port) -{ - assert(canvas); - assert(port); - - assert(PtrCast(port->parent())); - - /*resize(); - - const Atom& x_atom = port->get_variable("ingenuity:canvas-x"); - const Atom& y_atom = port->get_variable("ingenuity:canvas-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); - }*/ - - set_stacked_border(port->polyphonic()); - - port->signal_variable.connect(sigc::mem_fun(this, &PatchPortModule::set_variable)); - port->signal_property.connect(sigc::mem_fun(this, &PatchPortModule::set_property)); -} - - -boost::shared_ptr -PatchPortModule::create(boost::shared_ptr canvas, SharedPtr port) -{ - boost::shared_ptr ret = boost::shared_ptr( - new PatchPortModule(canvas, port)); - assert(ret); - - ret->_patch_port = boost::shared_ptr(new Port(ret, port, port->symbol(), true)); - - ret->add_port(ret->_patch_port); - - ret->set_menu(ret->_patch_port->menu()); - - for (GraphObject::Variables::const_iterator m = port->variables().begin(); m != port->variables().end(); ++m) - ret->set_variable(m->first, m->second); - - for (GraphObject::Properties::const_iterator m = port->properties().begin(); m != port->properties().end(); ++m) - ret->set_property(m->first, m->second); - - ret->resize(); - - return ret; -} - - -void -PatchPortModule::create_menu() -{ - Glib::RefPtr xml = GladeFactory::new_glade_reference(); - xml->get_widget_derived("object_menu", _menu); - _menu->init(_port, true); - - set_menu(_menu); -} - - -void -PatchPortModule::store_location() -{ - const float x = static_cast(property_x()); - const float y = static_cast(property_y()); - - const Atom& existing_x = _port->get_variable("ingenuity:canvas-x"); - const Atom& existing_y = _port->get_variable("ingenuity:canvas-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_variable(_port->path(), "ingenuity:canvas-x", Atom(x)); - App::instance().engine()->set_variable(_port->path(), "ingenuity:canvas-y", Atom(y)); - } -} - - -void -PatchPortModule::set_variable(const string& key, const Atom& value) -{ - if (key == "ingenuity:canvas-x" && value.type() == Atom::FLOAT) - move_to(value.get_float(), property_y()); - else if (key == "ingenuity:canvas-y" && value.type() == Atom::FLOAT) - move_to(property_x(), value.get_float()); -} - - -void -PatchPortModule::set_property(const string& key, const Atom& value) -{ - if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) { - set_stacked_border(value.get_bool()); - } else if (key == "ingen:selected" && value.type() == Atom::BOOL) { - if (value.get_bool() != selected()) { - if (value.get_bool()) - _canvas.lock()->select_item(shared_from_this()); - else - _canvas.lock()->unselect_item(shared_from_this()); - } - } -} - - -void -PatchPortModule::set_selected(bool b) -{ - if (b != selected()) { - Module::set_selected(b); - if (App::instance().signal()) - App::instance().engine()->set_property(_port->path(), "ingen:selected", b); - } -} - - - -} // namespace GUI -} // namespace Ingen -- cgit v1.2.1