diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/MachinaCanvas.cpp | 4 | ||||
-rw-r--r-- | src/gui/MachinaGUI.cpp | 6 | ||||
-rw-r--r-- | src/gui/NodeView.cpp | 45 | ||||
-rw-r--r-- | src/gui/NodeView.hpp | 4 | ||||
-rw-r--r-- | src/gui/machina.glade | 57 |
5 files changed, 59 insertions, 57 deletions
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 134b885..716a40d 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -52,6 +52,9 @@ MachinaCanvas::node_clicked(WeakPtr<NodeView> item, GdkEventButton* event) if (!node) return; + if (event->state & GDK_CONTROL_MASK) + return; + // Middle click, learn if (event->button == 2) { _app->machine()->learn(Machina::LearnRequest::create(_app->maid(), node->node())); @@ -192,6 +195,7 @@ void MachinaCanvas::build(SharedPtr<Machina::Machine> machine) { destroy(); + _last_clicked.reset(); if (!machine) return; diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index 3cf38bd..e5e6d90 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -608,6 +608,12 @@ void MachinaGUI::show_labels_toggled() { const bool show = _menu_view_labels->get_active(); + + for (ItemList::iterator i = _canvas->items().begin(); i != _canvas->items().end(); ++i) { + const SharedPtr<NodeView> nv = PtrCast<NodeView>(*i); + if (nv) + nv->show_label(show); + } for (ConnectionList::iterator c = _canvas->connections().begin(); c != _canvas->connections().end(); ++c) { diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index 6ff21ee..d38e228 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -15,6 +15,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include <machina/MidiAction.hpp> #include "NodeView.hpp" #include "NodePropertiesWindow.hpp" @@ -29,7 +30,8 @@ NodeView::NodeView(Gtk::Window* window, , _window(window) , _node(node) { - //signal_double_clicked.connect(sigc::mem_fun(this, &NodeView::on_double_click)); + signal_clicked.connect(sigc::mem_fun(this, &NodeView::handle_click)); + update_state(); } @@ -41,27 +43,50 @@ NodeView::on_double_click(GdkEventButton*) void -NodeView::on_click(GdkEventButton* event) +NodeView::handle_click(GdkEventButton* event) { if (event->state & GDK_CONTROL_MASK) { if (event->button == 1) { bool is_initial = _node->is_initial(); _node->set_initial( ! is_initial ); - set_border_width(is_initial ? 1.0 : 6.0); + update_state(); } else if (event->button == 3) { bool is_selector = _node->is_selector(); _node->set_selector( ! is_selector ); - set_border_width(is_selector ? 1.0 : 3.0); + update_state(); } } } void -NodeView::update_state() +NodeView::show_label(bool show) { - static const uint32_t active_color = 0x80808AFF; + char str[4]; + + SharedPtr<Machina::MidiAction> action + = PtrCast<Machina::MidiAction>(_node->enter_action()); + + if (show) { + if (action && action->event_size() >= 2 + && (action->event()[0] & 0xF0) == 0x90) { + + unsigned char note = action->event()[1]; + snprintf(str, 4, "%d", (int)note); + + set_name(str); + } + } else { + set_name(""); + } +} + +void +NodeView::update_state() +{ + static const uint32_t active_color = 0xA0A0AAFF; + if (_node->is_active()) { if (_color != active_color) { _old_color = _color; @@ -70,5 +95,13 @@ NodeView::update_state() } else if (_color == active_color) { set_base_color(_old_color); } + + if (_node->is_selector()) + if (_node->is_active()) + set_base_color(0x00FF00FF); + else + set_base_color(0x00A000FF); + + set_border_width(_node->is_initial() ? 4.0 : 1.0); } diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp index 4641787..41ff45f 100644 --- a/src/gui/NodeView.hpp +++ b/src/gui/NodeView.hpp @@ -32,11 +32,13 @@ public: double y); SharedPtr<Machina::Node> node() { return _node; } + + void show_label(bool show); void update_state(); private: - void on_click(GdkEventButton* ev); + void handle_click(GdkEventButton* ev); void on_double_click(GdkEventButton* ev); Gtk::Window* _window; diff --git a/src/gui/machina.glade b/src/gui/machina.glade index b5349be..61096f1 100644 --- a/src/gui/machina.glade +++ b/src/gui/machina.glade @@ -317,51 +317,6 @@ </child> <child> - <widget class="GtkToolButton" id="add_button"> - <property name="visible">True</property> - <property name="tooltip" translatable="yes">Add selected states</property> - <property name="stock_id">gtk-add</property> - <property name="visible_horizontal">True</property> - <property name="visible_vertical">True</property> - <property name="is_important">False</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - - <child> - <widget class="GtkToolButton" id="multiply_button"> - <property name="visible">True</property> - <property name="tooltip" translatable="yes">Multiply (merge) selected states</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">True</property> - <property name="stock_id">gtk-convert</property> - <property name="visible_horizontal">True</property> - <property name="visible_vertical">True</property> - <property name="is_important">False</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - - <child> - <widget class="GtkSeparatorToolItem" id="separatortoolitem5"> - <property name="visible">True</property> - <property name="draw">True</property> - <property name="visible_horizontal">True</property> - <property name="visible_vertical">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="homogeneous">False</property> - </packing> - </child> - - <child> <widget class="GtkToolItem" id="toolitem1"> <property name="visible">True</property> <property name="visible_horizontal">True</property> @@ -732,7 +687,8 @@ <property name="destroy_with_parent">True</property> <property name="name" translatable="yes">Machina</property> <property name="copyright" translatable="yes">© 2007 Dave Robillard <http://drobilla.net></property> - <property name="comments" translatable="yes">It's a machine</property> + <property name="comments" translatable="yes">A MIDI sequencer based on + probabilistic finite-state automata</property> <property name="license" translatable="yes">Machina is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -808,14 +764,15 @@ along with Machina; if not, write to the Free Software Foundation, Inc., <child> <widget class="GtkLabel" id="label5"> <property name="visible">True</property> - <property name="label" translatable="yes">Interface is still a bit arbitrary: + <property name="label" translatable="yes">Initial nodes are shown with a thick border. +Selector nodes are shown in green. - 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 - -Connect some nodes up and double click one. You'll get it.</property> +- 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</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> |