From a96166710faf2447ed10194d1829db5564b0dff9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 4 May 2007 03:59:38 +0000 Subject: Made engine, serialisation, client library, and GUI all dynamically loaded modules. Combined all executables into a single "ingen" program which can do everything. git-svn-id: http://svn.drobilla.net/lad/ingen@493 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/Port.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/libs/gui/Port.cpp (limited to 'src/libs/gui/Port.cpp') diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp new file mode 100644 index 00000000..9b21b8be --- /dev/null +++ b/src/libs/gui/Port.cpp @@ -0,0 +1,61 @@ +/* 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 +#include "interface/EngineInterface.h" +#include "client/PatchModel.h" +#include "client/PortModel.h" +#include "client/ControlModel.h" +#include "Configuration.h" +#include "App.h" +#include "Port.h" +using std::cerr; using std::endl; + +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + + +/** @param flip Make an input port appear as an output port, and vice versa. + */ +Port::Port(boost::shared_ptr module, SharedPtr pm, bool flip, bool destroyable) +: LibFlowCanvas::Port(module, + pm->path().name(), + flip ? (!pm->is_input()) : pm->is_input(), + App::instance().configuration()->get_port_color(pm.get())), + _port_model(pm) +{ + assert(module); + assert(_port_model); + + if (destroyable) + _menu.items().push_back(Gtk::Menu_Helpers::MenuElem("Destroy", + sigc::mem_fun(this, &Port::on_menu_destroy))); +} + + +void +Port::on_menu_destroy() +{ + App::instance().engine()->destroy(_port_model->path()); +} + + +} // namespace GUI +} // namespace Ingen -- cgit v1.2.1