From b9da1483a9f505879893d1882cba9e72babaa645 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 Mar 2007 02:45:37 +0000 Subject: Changed to middle click for adding nodes. Added visual representation of initial nodes (thick border). git-svn-id: http://svn.drobilla.net/lad/machina@372 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/MachinaCanvas.cpp | 34 ++++++++++++++++------------------ src/gui/NodeView.cpp | 2 +- src/gui/machina.glade | 10 +++++----- 3 files changed, 22 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 10334d0..6fdbc86 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -89,27 +89,25 @@ MachinaCanvas::canvas_event(GdkEvent* event) return false; if (event->type == GDK_BUTTON_RELEASE - && event->button.state & GDK_CONTROL_MASK) { - + && event->button.button == 2) { + const double x = event->button.x; const double y = event->button.y; - if (event->button.button == 1) { - string name = string("Note")+(char)(last++ +'0'); - - SharedPtr node(new Machina::Node(1.0, false)); - //node->add_enter_action(SharedPtr(new Machina::PrintAction(name))); - SharedPtr view(new NodeView(node, shared_from_this(), - name, x, y)); - - view->signal_clicked.connect(sigc::bind<0>(sigc::mem_fun(this, - &MachinaCanvas::node_clicked), WeakPtr(view))); - add_item(view); - view->resize(); - view->raise_to_top(); - - machine->add_node(node); - } + string name = string("Note")+(char)(last++ +'0'); + + SharedPtr node(new Machina::Node(1.0, false)); + //node->add_enter_action(SharedPtr(new Machina::PrintAction(name))); + SharedPtr view(new NodeView(node, shared_from_this(), + name, x, y)); + + view->signal_clicked.connect(sigc::bind<0>(sigc::mem_fun(this, + &MachinaCanvas::node_clicked), WeakPtr(view))); + add_item(view); + view->resize(); + view->raise_to_top(); + + machine->add_node(node); } return FlowCanvas::canvas_event(event); diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index f34c658..d675f1d 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -34,8 +34,8 @@ void NodeView::on_double_click(GdkEventButton*) { bool is_initial = _node->is_initial(); - std::cerr << "Initial: " << is_initial << std::endl; _node->set_initial( ! is_initial ); + set_border_width(is_initial ? 1.0 : 2.0); } diff --git a/src/gui/machina.glade b/src/gui/machina.glade index b53398b..8536e8f 100644 --- a/src/gui/machina.glade +++ b/src/gui/machina.glade @@ -85,7 +85,7 @@ - + True gtk-media-record 1 @@ -107,7 +107,7 @@ - + True gtk-convert 1 @@ -135,7 +135,7 @@ - + True gtk-convert 1 @@ -640,9 +640,9 @@ along with Machina; if not, write to the Free Software Foundation, Inc., True - Interface is a bit sketchy still: + Interface is still a bit arbitrary: -- Ctrl+Left click the canvas to create a new node +- Middle 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 make it an initial node -- cgit v1.2.1