aboutsummaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/MachinaCanvas.cpp14
-rw-r--r--src/gui/MachinaCanvas.hpp2
-rw-r--r--src/gui/NodeView.cpp11
-rw-r--r--src/gui/NodeView.hpp2
4 files changed, 18 insertions, 11 deletions
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<NodeView> item, GdkEventButton* event)
{
SharedPtr<NodeView> node = PtrCast<NodeView>(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<NodeView> last = _last_clicked.lock();
@@ -74,7 +74,11 @@ MachinaCanvas::node_clicked(WeakPtr<NodeView> 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<Client::ClientObject> 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<NodeView>(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<NodeView> item, GdkEventButton* ev);
+ bool node_clicked(WeakPtr<NodeView> item, GdkEventButton* ev);
private:
//SharedPtr<NodeView> create_node_view(SharedPtr<Machina::Node> 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<MachinaCanvas*>(_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);