From 3b1c0f0988922dad659a3ed3273dddd24fead682 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 17 Apr 2007 02:34:44 +0000 Subject: Event handling fixes. Changed button assignments to not conflict with canvas zooming. git-svn-id: http://svn.drobilla.net/lad/machina@450 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/EdgeView.cpp | 20 ++++++++++---------- src/gui/MachinaCanvas.cpp | 10 +++++++--- src/gui/machina.glade | 7 ++++--- 3 files changed, 21 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gui/EdgeView.cpp b/src/gui/EdgeView.cpp index faa89d0..dceb0d0 100644 --- a/src/gui/EdgeView.cpp +++ b/src/gui/EdgeView.cpp @@ -68,17 +68,17 @@ EdgeView::update_label() bool EdgeView::on_event(GdkEvent* ev) { - using namespace std; - if (ev->type == GDK_BUTTON_PRESS) { - if (ev->button.button == 1) { - _edge->set_probability(_edge->probability() - 0.1); - update_label(); - return true; - } else if (ev->button.button == 3) { - _edge->set_probability(_edge->probability() + 0.1); - update_label(); - return true; + if (ev->button.state & GDK_CONTROL_MASK) { + if (ev->button.button == 1) { + _edge->set_probability(_edge->probability() - 0.1); + update_label(); + return true; + } else if (ev->button.button == 3) { + _edge->set_probability(_edge->probability() + 0.1); + update_label(); + return true; + } } } diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index c689e24..d78c89d 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -84,7 +84,8 @@ MachinaCanvas::canvas_event(GdkEvent* event) return false; if (event->type == GDK_BUTTON_RELEASE - && event->button.button == 2) { + && event->button.button == 3 + && !(event->button.state & (GDK_CONTROL_MASK))) { const double x = event->button.x; const double y = event->button.y; @@ -102,9 +103,12 @@ MachinaCanvas::canvas_event(GdkEvent* event) view->raise_to_top(); machine->add_node(node); - } - return FlowCanvas::canvas_event(event); + return true; + + } else { + return FlowCanvas::canvas_event(event); + } } diff --git a/src/gui/machina.glade b/src/gui/machina.glade index c57bb88..8fcb8ad 100644 --- a/src/gui/machina.glade +++ b/src/gui/machina.glade @@ -640,7 +640,6 @@ along with Machina; if not, write to the Free Software Foundation, Inc., False False False - machina.svg gtk-help True False @@ -689,12 +688,14 @@ along with Machina; if not, write to the Free Software Foundation, Inc., Initial nodes are shown with a thick border. Selector nodes are shown in green. -- Middle click canvas to create a new node +- Right click canvas to create a new node - Middle click nodes to learn a MIDI note for that node - Right click two nodes in succession to connect nodes - Double click a node to show its properties dialog - Ctrl+Left click a node to make it an initial node -- Ctrl+Right click a node to make it a selector node +- Ctrl+Right click a node to make it a selector node +- Ctrl+Left click edge probabilities to decrease +- Ctrl+Right click edge probabilities to increase False False GTK_JUSTIFY_LEFT -- cgit v1.2.1