diff options
author | David Robillard <d@drobilla.net> | 2006-10-03 22:24:22 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-10-03 22:24:22 +0000 |
commit | 91d5cb109563c67bdad5f3ebeaafc8e1e8f7e14a (patch) | |
tree | cb70af457552eb1b87f745989f41c31da8220583 /src/progs/ingenuity/NodeModule.h | |
parent | 35a5d92cfcf6815553a0939c3e2bf77c1108fd31 (diff) | |
download | ingen-91d5cb109563c67bdad5f3ebeaafc8e1e8f7e14a.tar.gz ingen-91d5cb109563c67bdad5f3ebeaafc8e1e8f7e14a.tar.bz2 ingen-91d5cb109563c67bdad5f3ebeaafc8e1e8f7e14a.zip |
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
Diffstat (limited to 'src/progs/ingenuity/NodeModule.h')
-rw-r--r-- | src/progs/ingenuity/NodeModule.h | 28 |
1 files changed, 16 insertions, 12 deletions
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 <string> +#include <boost/enable_shared_from_this.hpp> #include <libgnomecanvasmm.h> #include <flowcanvas/Module.h> -#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<NodeModule>, public LibFlowCanvas::Module { public: - NodeModule(PatchCanvas* canvas, CountedPtr<NodeModel> node); + static boost::shared_ptr<NodeModule> create (boost::shared_ptr<PatchCanvas> canvas, CountedPtr<NodeModel> node); + virtual ~NodeModule() {} - - virtual Ingenuity::Port* port(const string& port_name) { - return (Ingenuity::Port*)Module::get_port(port_name); + + boost::shared_ptr<Port> port(const string& port_name) { + return boost::dynamic_pointer_cast<Ingenuity::Port>( + Module::get_port(port_name)); } virtual void store_location(); @@ -65,16 +69,16 @@ public: CountedPtr<NodeModel> node() const { return m_node; } protected: + NodeModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<NodeModel> 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<PortModel> port); - void remove_port(CountedPtr<PortModel> port); - + + void add_port(CountedPtr<PortModel> port, bool resize=true); + void remove_port(CountedPtr<PortModel> port) { Module::remove_port(port->path().name()); } + CountedPtr<NodeModel> m_node; NodeMenu m_menu; }; |