aboutsummaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-12 00:17:35 +0000
committerDavid Robillard <d@drobilla.net>2013-01-12 00:17:35 +0000
commit932a899e53ba1252d1983412e825fd08f2f99cdc (patch)
tree2f2d62d69fea59ca44655ab40a74bb7773272c13 /src/gui
parent6c61c79d43d1d4715ce04b46e459279d0fa6c854 (diff)
downloadmachina-932a899e53ba1252d1983412e825fd08f2f99cdc.tar.gz
machina-932a899e53ba1252d1983412e825fd08f2f99cdc.tar.bz2
machina-932a899e53ba1252d1983412e825fd08f2f99cdc.zip
Make double click show properties window.
Fix crash on bad arc notifications. Show note label on nodes. Fix clash of machina_Edge and machina_MidiAction (duh). git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4927 a436a847-0d15-0410-975c-d299462d15a1
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);