summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity
diff options
context:
space:
mode:
Diffstat (limited to 'src/progs/ingenuity')
-rw-r--r--src/progs/ingenuity/PatchPortModule.cpp2
-rw-r--r--src/progs/ingenuity/Port.cpp18
-rw-r--r--src/progs/ingenuity/Port.h9
-rw-r--r--src/progs/ingenuity/ThreadedLoader.cpp9
4 files changed, 23 insertions, 15 deletions
diff --git a/src/progs/ingenuity/PatchPortModule.cpp b/src/progs/ingenuity/PatchPortModule.cpp
index e1fb37a8..e4c00130 100644
--- a/src/progs/ingenuity/PatchPortModule.cpp
+++ b/src/progs/ingenuity/PatchPortModule.cpp
@@ -68,7 +68,7 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortMod
new PatchPortModule(canvas, port));
assert(ret);
- ret->m_patch_port = boost::shared_ptr<Port>(new Port(ret, port, true));
+ ret->m_patch_port = boost::shared_ptr<Port>(new Port(ret, port, true, true));
ret->add_port(ret->m_patch_port);
ret->resize();
diff --git a/src/progs/ingenuity/Port.cpp b/src/progs/ingenuity/Port.cpp
index 5d12cffa..e8e795d0 100644
--- a/src/progs/ingenuity/Port.cpp
+++ b/src/progs/ingenuity/Port.cpp
@@ -21,6 +21,7 @@
#include "PortModel.h"
#include "ControlModel.h"
#include "Configuration.h"
+#include "ModelEngineInterface.h"
#include "App.h"
using std::cerr; using std::endl;
@@ -31,15 +32,26 @@ namespace Ingenuity {
/** @param flip Make an input port appear as an output port, and vice versa.
*/
-Port::Port(boost::shared_ptr<LibFlowCanvas::Module> module, SharedPtr<PortModel> pm, bool flip)
+Port::Port(boost::shared_ptr<LibFlowCanvas::Module> module, SharedPtr<PortModel> 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())),
- m_port_model(pm)
+ _port_model(pm)
{
assert(module);
- assert(m_port_model);
+ assert(_port_model);
+
+ if (destroyable)
+ m_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());
}
diff --git a/src/progs/ingenuity/Port.h b/src/progs/ingenuity/Port.h
index a23cd2c9..0498b5a8 100644
--- a/src/progs/ingenuity/Port.h
+++ b/src/progs/ingenuity/Port.h
@@ -35,14 +35,17 @@ namespace Ingenuity {
class Port : public LibFlowCanvas::Port
{
public:
- Port(boost::shared_ptr<LibFlowCanvas::Module> module, SharedPtr<PortModel> pm, bool flip = false);
+ Port(boost::shared_ptr<LibFlowCanvas::Module> module, SharedPtr<PortModel> pm, bool flip = false, bool destroyable = false);
virtual ~Port() {}
- SharedPtr<PortModel> model() const { return m_port_model; }
+ SharedPtr<PortModel> model() const { return _port_model; }
private:
- SharedPtr<PortModel> m_port_model;
+
+ void on_menu_destroy();
+
+ SharedPtr<PortModel> _port_model;
};
diff --git a/src/progs/ingenuity/ThreadedLoader.cpp b/src/progs/ingenuity/ThreadedLoader.cpp
index 79cd8507..83b3d6b5 100644
--- a/src/progs/ingenuity/ThreadedLoader.cpp
+++ b/src/progs/ingenuity/ThreadedLoader.cpp
@@ -55,7 +55,7 @@ ThreadedLoader::_whipped()
_mutex.unlock();
}
-/** FIXME: most of these paramteres do nothing */
+/** FIXME: use poly parameter */
void
ThreadedLoader::load_patch(bool merge,
const string& data_base_uri,
@@ -67,13 +67,6 @@ ThreadedLoader::load_patch(bool merge,
{
_mutex.lock();
- /*_events.push_back(sigc::hide_return(sigc::bind(
- sigc::mem_fun(_loader, &Loader::load_patch),
- merge, data_base_uri, data_path,
- engine_data, engine_parent, engine_name, engine_poly)));*/
-
- cerr << "FIXME: load under root only\n";
-
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_loader, &Loader::load),
data_base_uri,