aboutsummaryrefslogtreecommitdiffstats
path: root/src/gui/MachinaCanvas.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-06-07 02:44:16 +0000
committerDavid Robillard <d@drobilla.net>2011-06-07 02:44:16 +0000
commitd4785081aea2092ac7a98e1ef3ec6031574286e8 (patch)
treee208c48f3a508aa953a92d7409b00de2a3679f19 /src/gui/MachinaCanvas.cpp
parent0bfaff9535291d6074d1541af2f7f83c61605d7f (diff)
downloadmachina-d4785081aea2092ac7a98e1ef3ec6031574286e8.tar.gz
machina-d4785081aea2092ac7a98e1ef3ec6031574286e8.tar.bz2
machina-d4785081aea2092ac7a98e1ef3ec6031574286e8.zip
Remove use of smart pointers in FlowCanvas entirely.
Since FlowCanvas's containers own their children, there is no real benefit to using smart pointers for objects, though there is overhead. There are no longer any add or remove methods for containers, simply create (new) and destroy (delete) objects and things should work as expected. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@3366 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui/MachinaCanvas.cpp')
-rw-r--r--src/gui/MachinaCanvas.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index efb677f..2869c22 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -62,7 +62,7 @@ MachinaCanvas::node_clicked(WeakPtr<NodeView> item, GdkEventButton* event)
if (last) {
if (node != last) {
- if (get_connection(last, node))
+ if (get_connection(last.get(), node.get()))
action_disconnect(last, node);
else
action_connect(last, node);
@@ -112,7 +112,7 @@ MachinaCanvas::on_new_object(SharedPtr<Client::ClientObject> object)
WeakPtr<NodeView>(view)));
object->set_view(view);
- add_item(view);
+ add_item(view.get());
} else if (type == "machina:Edge") {
SharedPtr<Machina::Client::ClientObject> tail = _app->client_model()->find(
@@ -126,11 +126,11 @@ MachinaCanvas::on_new_object(SharedPtr<Client::ClientObject> object)
SharedPtr<EdgeView> view(
new EdgeView(*this, tail_view, head_view, object));
- tail_view->add_connection(view);
- head_view->add_connection(view);
+ tail_view->add_connection(view.get());
+ head_view->add_connection(view.get());
object->set_view(view);
- add_connection(view);
+ add_connection(view.get());
} else {
Raul::error << "Unknown object type " << type << std::endl;
@@ -142,14 +142,11 @@ MachinaCanvas::on_erase_object(SharedPtr<Client::ClientObject> object)
{
const Raul::Atom& type = object->get(URIs::instance().rdf_type);
if (type == "machina:Node") {
- SharedPtr<NodeView> view = PtrCast<NodeView>(object->view());
- if (view) {
- remove_item(view);
- }
+ // Destruction of the view will remove from the canvas
} else if (type == "machina:Edge") {
SharedPtr<EdgeView> view = PtrCast<EdgeView>(object->view());
if (view) {
- remove_connection(view->source().lock(), view->dest().lock());
+ remove_connection(view->source(), view->dest());
}
} else {
Raul::error << "Unknown object type " << type << std::endl;