summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/Connection.cpp2
-rw-r--r--src/gui/Connection.hpp2
-rw-r--r--src/gui/NodeModule.cpp16
-rw-r--r--src/gui/NodeModule.hpp10
-rw-r--r--src/gui/PatchCanvas.cpp17
-rw-r--r--src/gui/PatchPortModule.cpp15
-rw-r--r--src/gui/PatchPortModule.hpp10
-rw-r--r--src/gui/SubpatchModule.cpp5
-rw-r--r--src/gui/SubpatchModule.hpp5
9 files changed, 36 insertions, 46 deletions
diff --git a/src/gui/Connection.cpp b/src/gui/Connection.cpp
index 60380537..5d1ceed7 100644
--- a/src/gui/Connection.cpp
+++ b/src/gui/Connection.cpp
@@ -25,7 +25,7 @@ using namespace std;
namespace Ingen {
namespace GUI {
-Connection::Connection(boost::shared_ptr<FlowCanvas::Canvas> canvas,
+Connection::Connection(FlowCanvas::Canvas& canvas,
boost::shared_ptr<const ConnectionModel> model,
boost::shared_ptr<FlowCanvas::Connectable> src,
boost::shared_ptr<FlowCanvas::Connectable> dst,
diff --git a/src/gui/Connection.hpp b/src/gui/Connection.hpp
index fb30a7c0..7bd39ff5 100644
--- a/src/gui/Connection.hpp
+++ b/src/gui/Connection.hpp
@@ -37,7 +37,7 @@ namespace GUI {
class Connection : public FlowCanvas::Connection
{
public:
- Connection(boost::shared_ptr<FlowCanvas::Canvas> canvas,
+ Connection(FlowCanvas::Canvas& canvas,
boost::shared_ptr<const ConnectionModel> model,
boost::shared_ptr<FlowCanvas::Connectable> src,
boost::shared_ptr<FlowCanvas::Connectable> dst,
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index a0a147c8..2c14557a 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -43,9 +43,9 @@ using namespace Raul;
namespace Ingen {
namespace GUI {
-NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const NodeModel> node)
- : FlowCanvas::Module(canvas, node->path().symbol(), 0, 0, true, canvas->show_port_names())
+NodeModule::NodeModule(PatchCanvas& canvas,
+ SharedPtr<const NodeModel> node)
+ : FlowCanvas::Module(canvas, node->path().symbol(), 0, 0, true, canvas.show_port_names())
, _node(node)
, _gui_widget(NULL)
, _gui_window(NULL)
@@ -87,9 +87,9 @@ NodeModule::create_menu()
}
boost::shared_ptr<NodeModule>
-NodeModule::create(boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const NodeModel> node,
- bool human)
+NodeModule::create(PatchCanvas& canvas,
+ SharedPtr<const NodeModel> node,
+ bool human)
{
boost::shared_ptr<NodeModule> ret;
@@ -401,9 +401,9 @@ NodeModule::property_changed(const URI& key, const Atom& value)
} else if (key == uris.ingen_selected) {
if (value.get_bool() != selected()) {
if (value.get_bool())
- _canvas.lock()->select_item(shared_from_this());
+ _canvas->select_item(shared_from_this());
else
- _canvas.lock()->unselect_item(shared_from_this());
+ _canvas->unselect_item(shared_from_this());
}
}
break;
diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp
index 78a301c5..7a62b87f 100644
--- a/src/gui/NodeModule.hpp
+++ b/src/gui/NodeModule.hpp
@@ -48,10 +48,10 @@ class NodeMenu;
class NodeModule : public FlowCanvas::Module
{
public:
- static boost::shared_ptr<NodeModule> create (
- boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const NodeModel> node,
- bool human_names);
+ static boost::shared_ptr<NodeModule> create(
+ PatchCanvas& canvas,
+ SharedPtr<const NodeModel> node,
+ bool human_names);
virtual ~NodeModule();
@@ -65,7 +65,7 @@ public:
SharedPtr<const NodeModel> node() const { return _node; }
protected:
- NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<const NodeModel> node);
+ NodeModule(PatchCanvas& canvas, SharedPtr<const NodeModel> node);
void on_double_click(GdkEventButton* ev);
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 70efb855..2ff1a1c5 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -275,9 +275,6 @@ PatchCanvas::build_plugin_menu()
void
PatchCanvas::build()
{
- boost::shared_ptr<PatchCanvas> shared_this =
- boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this());
-
// Create modules for nodes
for (Store::const_iterator i = App::instance().store()->children_begin(_patch);
i != App::instance().store()->children_end(_patch); ++i) {
@@ -387,15 +384,12 @@ PatchCanvas::add_plugin(SharedPtr<PluginModel> p)
void
PatchCanvas::add_node(SharedPtr<const NodeModel> nm)
{
- boost::shared_ptr<PatchCanvas> shared_this =
- boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this());
-
SharedPtr<const PatchModel> pm = PtrCast<const PatchModel>(nm);
SharedPtr<NodeModule> module;
if (pm) {
- module = SubpatchModule::create(shared_this, pm, _human_names);
+ module = SubpatchModule::create(*this, pm, _human_names);
} else {
- module = NodeModule::create(shared_this, nm, _human_names);
+ module = NodeModule::create(*this, nm, _human_names);
const PluginModel* plugm = dynamic_cast<const PluginModel*>(nm->plugin());
if (plugm && !plugm->icon_path().empty())
module->set_icon(App::instance().icon_from_path(plugm->icon_path(), 100));
@@ -420,10 +414,7 @@ PatchCanvas::remove_node(SharedPtr<const NodeModel> nm)
void
PatchCanvas::add_port(SharedPtr<const PortModel> pm)
{
- boost::shared_ptr<PatchCanvas> shared_this =
- boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this());
-
- SharedPtr<PatchPortModule> view = PatchPortModule::create(shared_this, pm, _human_names);
+ SharedPtr<PatchPortModule> view = PatchPortModule::create(*this, pm, _human_names);
_views.insert(std::make_pair(pm, view));
add_item(view);
view->show();
@@ -486,7 +477,7 @@ PatchCanvas::connection(SharedPtr<const ConnectionModel> cm)
if (src && dst) {
add_connection(
boost::shared_ptr<GUI::Connection>(
- new GUI::Connection(shared_from_this(), cm, src, dst,
+ new GUI::Connection(*this, cm, src, dst,
src->color() + 0x22222200)));
} else {
LOG(error) << "Unable to find ports to connect "
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 14861069..b04cc6ba 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -38,12 +38,11 @@ using namespace Raul;
namespace Ingen {
namespace GUI {
-PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const PortModel> model)
+PatchPortModule::PatchPortModule(PatchCanvas& canvas,
+ SharedPtr<const PortModel> model)
: FlowCanvas::Module(canvas, "", 0, 0, false) // FIXME: coords?
, _model(model)
{
- assert(canvas);
assert(model);
assert(PtrCast<const PatchModel>(model->parent()));
@@ -55,9 +54,9 @@ PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas,
}
boost::shared_ptr<PatchPortModule>
-PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const PortModel> model,
- bool human)
+PatchPortModule::create(PatchCanvas& canvas,
+ SharedPtr<const PortModel> model,
+ bool human)
{
boost::shared_ptr<PatchPortModule> ret(new PatchPortModule(canvas, model));
boost::shared_ptr<Port> port(Port::create(ret, model, human, true));
@@ -150,9 +149,9 @@ PatchPortModule::property_changed(const URI& key, const Atom& value)
} else if (key == uris.ingen_selected) {
if (value.get_bool() != selected()) {
if (value.get_bool()) {
- _canvas.lock()->select_item(shared_from_this());
+ _canvas->select_item(shared_from_this());
} else {
- _canvas.lock()->unselect_item(shared_from_this());
+ _canvas->unselect_item(shared_from_this());
}
}
}
diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp
index 7cdc3653..9334c48f 100644
--- a/src/gui/PatchPortModule.hpp
+++ b/src/gui/PatchPortModule.hpp
@@ -50,9 +50,9 @@ class PatchPortModule : public FlowCanvas::Module
{
public:
static boost::shared_ptr<PatchPortModule> create(
- boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const PortModel> model,
- bool human);
+ PatchCanvas& canvas,
+ SharedPtr<const PortModel> model,
+ bool human);
virtual void store_location();
void show_human_names(bool b);
@@ -62,8 +62,8 @@ public:
SharedPtr<const PortModel> port() const { return _model; }
protected:
- PatchPortModule(boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const PortModel> model);
+ PatchPortModule(PatchCanvas& canvas,
+ SharedPtr<const PortModel> model);
void create_menu();
void set_selected(bool b);
diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp
index f26128af..8481d185 100644
--- a/src/gui/SubpatchModule.cpp
+++ b/src/gui/SubpatchModule.cpp
@@ -30,12 +30,11 @@
namespace Ingen {
namespace GUI {
-SubpatchModule::SubpatchModule(boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const PatchModel> patch)
+SubpatchModule::SubpatchModule(PatchCanvas& canvas,
+ SharedPtr<const PatchModel> patch)
: NodeModule(canvas, patch)
, _patch(patch)
{
- assert(canvas);
assert(patch);
}
diff --git a/src/gui/SubpatchModule.hpp b/src/gui/SubpatchModule.hpp
index 7eba97a2..b58c78fa 100644
--- a/src/gui/SubpatchModule.hpp
+++ b/src/gui/SubpatchModule.hpp
@@ -46,8 +46,9 @@ class NodeControlWindow;
class SubpatchModule : public NodeModule
{
public:
- SubpatchModule(boost::shared_ptr<PatchCanvas> canvas,
- SharedPtr<const PatchModel> controller);
+ SubpatchModule(PatchCanvas& canvas,
+ SharedPtr<const PatchModel> controller);
+
virtual ~SubpatchModule() {}
void on_double_click(GdkEventButton* ev);