From 972b8d42b13a9e006f1ca50dcd76e579bb5f2394 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 1 Dec 2011 03:40:57 +0000 Subject: Remove menu stuff from FlowCanvas. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@3717 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/MachinaCanvas.cpp | 14 +++++++++----- src/gui/MachinaCanvas.hpp | 2 +- src/gui/NodeView.cpp | 11 +++++++---- src/gui/NodeView.hpp | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src/gui') diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 17cfb4c..a11e40a 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -42,19 +42,19 @@ MachinaCanvas::MachinaCanvas(MachinaGUI* app, int width, int height) widget().grab_focus(); } -void +bool MachinaCanvas::node_clicked(WeakPtr item, GdkEventButton* event) { SharedPtr node = PtrCast(item.lock()); if (!node) - return; + return false; if (event->state & GDK_CONTROL_MASK) - return; + return false; if (event->button == 2) { // Middle click: learn _app->controller()->learn(_app->maid(), node->node()->id()); - return; + return false; } else if (event->button == 3) { // Right click: connect/disconnect SharedPtr last = _last_clicked.lock(); @@ -74,7 +74,11 @@ MachinaCanvas::node_clicked(WeakPtr item, GdkEventButton* event) _last_clicked = node; node->set_base_color(0xFF0000FF); } + + return true; } + + return false; } bool @@ -106,7 +110,7 @@ MachinaCanvas::on_new_object(SharedPtr object) //if ( ! node->enter_action() && ! node->exit_action() ) // view->set_base_color(0x101010FF); - view->signal_clicked.connect( + view->signal_clicked().connect( sigc::bind<0>(sigc::mem_fun(this, &MachinaCanvas::node_clicked), WeakPtr(view))); diff --git a/src/gui/MachinaCanvas.hpp b/src/gui/MachinaCanvas.hpp index 671f5d9..8eba8d2 100644 --- a/src/gui/MachinaCanvas.hpp +++ b/src/gui/MachinaCanvas.hpp @@ -46,7 +46,7 @@ public: protected: bool canvas_event(GdkEvent* event); - void node_clicked(WeakPtr item, GdkEventButton* ev); + bool node_clicked(WeakPtr item, GdkEventButton* ev); private: //SharedPtr create_node_view(SharedPtr node); diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index 77ccd4d..2312493 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -40,8 +40,8 @@ NodeView::NodeView(Gtk::Window* window, , _default_border_color(_border_color) , _old_color(_color) { - signal_clicked.connect( - sigc::mem_fun(this, &NodeView::handle_click)); + _signal_clicked.connect( + sigc::mem_fun(this, &NodeView::on_click)); node->signal_property.connect( sigc::mem_fun(this, &NodeView::on_property)); @@ -60,8 +60,8 @@ NodeView::node_is(Machina::URIInt key) return value.type() == Raul::Atom::BOOL && value.get_bool(); } -void -NodeView::handle_click(GdkEventButton* event) +bool +NodeView::on_click(GdkEventButton* event) { if (event->state & GDK_CONTROL_MASK) { MachinaCanvas* canvas = dynamic_cast(_canvas); @@ -70,13 +70,16 @@ NodeView::handle_click(GdkEventButton* event) _node->id(), URIs::instance().machina_initial, !node_is(URIs::instance().machina_initial)); + return true; } else if (event->button == 3) { canvas->app()->controller()->set_property( _node->id(), URIs::instance().machina_selector, !node_is(URIs::instance().machina_selector)); + return true; } } + return false; } static std::string diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp index 29ceb9b..5190e04 100644 --- a/src/gui/NodeView.hpp +++ b/src/gui/NodeView.hpp @@ -41,7 +41,7 @@ public: void update_state(bool show_labels); private: - void handle_click(GdkEventButton* ev); + bool on_click(GdkEventButton* ev); void on_double_click(GdkEventButton* ev); void on_property(Machina::URIInt key, const Raul::Atom& value); void on_action_property(Machina::URIInt key, const Raul::Atom& value); -- cgit v1.2.1