From 91d5cb109563c67bdad5f3ebeaafc8e1e8f7e14a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 3 Oct 2006 22:24:22 +0000 Subject: shared_ptr bugfixes. Updated Ingen to work with new FlowCanvas. Updated Patchage to work with new(er) FlowCanvas. git-svn-id: http://svn.drobilla.net/lad/ingen@152 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/ingenuity/NodeModule.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/progs/ingenuity/NodeModule.h') diff --git a/src/progs/ingenuity/NodeModule.h b/src/progs/ingenuity/NodeModule.h index 6f7460bf..cbdfc6d2 100644 --- a/src/progs/ingenuity/NodeModule.h +++ b/src/progs/ingenuity/NodeModule.h @@ -18,10 +18,12 @@ #define OMMODULE_H #include +#include #include #include -#include "NodeMenu.h" #include "util/CountedPtr.h" +#include "Port.h" +#include "NodeMenu.h" using std::string; class Atom; @@ -46,14 +48,16 @@ class Port; * * \ingroup Ingenuity */ -class NodeModule : public LibFlowCanvas::Module +class NodeModule : public boost::enable_shared_from_this, public LibFlowCanvas::Module { public: - NodeModule(PatchCanvas* canvas, CountedPtr node); + static boost::shared_ptr create (boost::shared_ptr canvas, CountedPtr node); + virtual ~NodeModule() {} - - virtual Ingenuity::Port* port(const string& port_name) { - return (Ingenuity::Port*)Module::get_port(port_name); + + boost::shared_ptr port(const string& port_name) { + return boost::dynamic_pointer_cast( + Module::get_port(port_name)); } virtual void store_location(); @@ -65,16 +69,16 @@ public: CountedPtr node() const { return m_node; } protected: + NodeModule(boost::shared_ptr canvas, CountedPtr node); + virtual void on_double_click(GdkEventButton* ev) { show_control_window(); } virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); } - void set_all_metadata(); void metadata_update(const string& key, const Atom& value); - - void create_all_ports(); - void add_port(CountedPtr port); - void remove_port(CountedPtr port); - + + void add_port(CountedPtr port, bool resize=true); + void remove_port(CountedPtr port) { Module::remove_port(port->path().name()); } + CountedPtr m_node; NodeMenu m_menu; }; -- cgit v1.2.1