aboutsummaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/MachinaCanvas.cpp5
-rw-r--r--src/gui/NodeView.cpp29
-rw-r--r--src/gui/NodeView.hpp2
3 files changed, 24 insertions, 12 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index 57cffc9..a2bb2ac 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -121,6 +121,11 @@ MachinaCanvas::on_new_object(SharedPtr<Client::ClientObject> object)
SharedPtr<Machina::Client::ClientObject> head = _app->client_model()->find(
object->get(uris.machina_head_id).get_int32());
+ if (!tail || !head) {
+ std::cerr << "Invalid arc" << std::endl;
+ return;
+ }
+
SharedPtr<NodeView> tail_view = PtrCast<NodeView>(tail->view());
SharedPtr<NodeView> head_view = PtrCast<NodeView>(head->view());
diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp
index bf7c0b6..d388921 100644
--- a/src/gui/NodeView.cpp
+++ b/src/gui/NodeView.cpp
@@ -47,10 +47,11 @@ NodeView::NodeView(Gtk::Window* window,
sigc::mem_fun(this, &NodeView::on_property));
}
-void
+bool
NodeView::on_double_click(GdkEventButton*)
{
NodePropertiesWindow::present(_window, _node);
+ return true;
}
bool
@@ -83,6 +84,8 @@ NodeView::on_event(GdkEvent* event)
} else {
_signal_clicked.emit(&event->button);
}
+ } else if (event->type == GDK_2BUTTON_PRESS) {
+ return on_double_click(&event->button);
}
return false;
}
@@ -103,13 +106,11 @@ midi_note_name(uint8_t num)
void
NodeView::show_label(bool show)
{
- if (show) {
- if (_enter_action) {
- Raul::Atom note_number = _enter_action->get(URIs::instance().machina_note_number);
- if (note_number.is_valid()) {
- set_label(midi_note_name(note_number.get_int32()).c_str());
- return;
- }
+ if (show && _enter_action) {
+ Raul::Atom note_number = _enter_action->get(URIs::instance().machina_note_number);
+ if (note_number.is_valid()) {
+ set_label(midi_note_name(note_number.get_int32()).c_str());
+ return;
}
}
@@ -150,8 +151,13 @@ NodeView::on_property(Machina::URIInt key, const Raul::Atom& value)
MachinaCanvas* canvas = dynamic_cast<MachinaCanvas*>(this->canvas());
_enter_action_connection.disconnect();
_enter_action = canvas->app()->client_model()->find(action_id);
- _enter_action_connection = _enter_action->signal_property.connect(
- sigc::mem_fun(this, &NodeView::on_action_property));
+ if (_enter_action) {
+ _enter_action_connection = _enter_action->signal_property.connect(
+ sigc::mem_fun(this, &NodeView::on_action_property));
+ for (auto i : _enter_action->properties()) {
+ on_action_property(i.first, i.second);
+ }
+ }
} else {
cout << "Unknown property " << key << endl;
}
@@ -160,8 +166,9 @@ NodeView::on_property(Machina::URIInt key, const Raul::Atom& value)
void
NodeView::on_action_property(Machina::URIInt key, const Raul::Atom& value)
{
- if (key == URIs::instance().machina_note_number)
+ if (key == URIs::instance().machina_note_number) {
show_label(true);
+ }
}
void
diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp
index eb7a61f..61e4838 100644
--- a/src/gui/NodeView.hpp
+++ b/src/gui/NodeView.hpp
@@ -48,7 +48,7 @@ public:
private:
bool on_event(GdkEvent* ev);
- void on_double_click(GdkEventButton* ev);
+ bool 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);
void set_selected(gboolean selected);