aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-11 04:03:20 +0000
committerDavid Robillard <d@drobilla.net>2007-02-11 04:03:20 +0000
commit9be91674f5de3da9d27b6afcdf9d76d27f5b40cb (patch)
tree9841651284004afffa84a29b08c08b43b7a119e9
parentda3ac16cbfbf66edebe929f8d9bf7d76ab24dd74 (diff)
downloadmachina-9be91674f5de3da9d27b6afcdf9d76d27f5b40cb.tar.gz
machina-9be91674f5de3da9d27b6afcdf9d76d27f5b40cb.tar.bz2
machina-9be91674f5de3da9d27b6afcdf9d76d27f5b40cb.zip
Machina animation.
git-svn-id: http://svn.drobilla.net/lad/machina@303 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/engine/Machine.cpp7
-rw-r--r--src/gui/MachinaCanvas.cpp22
-rw-r--r--src/gui/MachinaGUI.cpp26
-rw-r--r--src/gui/MachinaGUI.hpp5
-rw-r--r--src/gui/machina.glade93
5 files changed, 139 insertions, 14 deletions
diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp
index 476e3d1..dbb212c 100644
--- a/src/engine/Machine.cpp
+++ b/src/engine/Machine.cpp
@@ -130,13 +130,14 @@ Machine::run(FrameCount nframes)
bool entered = false;
if ( ! _nodes.empty()) {
for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) {
+
+ assert( ! (*n)->is_active());
+
if ((*n)->is_initial()) {
(*n)->enter(0);
entered = true;
- } else {
- if ((*n)->is_active())
- (*n)->exit(0);
}
+
}
}
if (!entered) {
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index d725253..a691c9f 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -57,15 +57,21 @@ MachinaCanvas::node_clicked(SharedPtr<NodeView> item, GdkEventButton* event)
if (event->button == 2) {
_app->machine()->learn(Machina::LearnRequest::create(_app->maid(), node->node()));
return;
- }
+ } else if (event->button == 3) {
- SharedPtr<NodeView> last = _last_clicked.lock();
+ SharedPtr<NodeView> last = _last_clicked.lock();
- if (last) {
- connect_node(last, node);
- _last_clicked.reset();
- } else {
- _last_clicked = node;
+ if (last) {
+ if (node != last)
+ connect_node(last, node);
+
+ last->set_default_base_color();
+ _last_clicked.reset();
+
+ } else {
+ _last_clicked = node;
+ node->set_base_color(0xFF0000FF);
+ }
}
}
@@ -77,7 +83,7 @@ MachinaCanvas::canvas_event(GdkEvent* event)
assert(event);
- if (event->type == GDK_BUTTON_PRESS) {
+ if (event->type == GDK_BUTTON_RELEASE) {
const double x = event->button.x;
const double y = event->button.y;
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp
index f091e60..dab150f 100644
--- a/src/gui/MachinaGUI.cpp
+++ b/src/gui/MachinaGUI.cpp
@@ -23,6 +23,7 @@
#include <pthread.h>
#include "MachinaGUI.hpp"
#include "MachinaCanvas.hpp"
+#include "NodeView.hpp"
//#include "config.h"
@@ -105,10 +106,12 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Machine> machine)
xml->get_widget("machina_win", _main_window);
xml->get_widget("about_win", _about_window);
+ xml->get_widget("help_dialog", _help_dialog);
xml->get_widget("file_quit_menuitem", _menu_file_quit);
xml->get_widget("view_refresh_menuitem", _menu_view_refresh);
xml->get_widget("view_messages_menuitem", _menu_view_messages);
xml->get_widget("help_about_menuitem", _menu_help_about);
+ xml->get_widget("help_help_menuitem", _menu_help_help);
xml->get_widget("canvas_scrolledwindow", _canvas_scrolledwindow);
xml->get_widget("status_text", _status_text);
xml->get_widget("main_paned", _main_paned);
@@ -132,6 +135,7 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Machine> machine)
_menu_view_refresh->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_view_refresh));
_menu_view_messages->signal_toggled().connect( sigc::mem_fun(this, &MachinaGUI::show_messages_toggled));
_menu_help_about->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_help_about));
+ _menu_help_help->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_help_help));
connect_widgets();
@@ -156,7 +160,14 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Machine> machine)
_pane_closed = true;
// Idle callback to drive the maid (collect garbage)
- Glib::signal_timeout().connect(sigc::mem_fun(this, &MachinaGUI::idle_callback), 1000);
+ Glib::signal_timeout().connect(
+ sigc::bind_return(
+ sigc::mem_fun(_maid.get(), &Raul::Maid::cleanup),
+ true),
+ 1000);
+
+ // Idle callback to update node states
+ Glib::signal_timeout().connect(sigc::mem_fun(this, &MachinaGUI::idle_callback), 100);
// Faster idle callback to update DSP load progress bar
//Glib::signal_timeout().connect(sigc::mem_fun(this, &MachinaGUI::update_load), 50);
@@ -186,7 +197,12 @@ MachinaGUI::attach()
bool
MachinaGUI::idle_callback()
{
- _maid->cleanup();
+ for (ItemMap::iterator i = _canvas->items().begin(); i != _canvas->items().end(); ++i) {
+ SharedPtr<NodeView> nv = PtrCast<NodeView>(i->second);
+ if (nv)
+ nv->update_state();
+ }
+
return true;
}
@@ -343,3 +359,9 @@ MachinaGUI::menu_help_about()
}
+void
+MachinaGUI::menu_help_help()
+{
+ _help_dialog->run();
+ _help_dialog->hide();
+}
diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp
index 23b9dba..147a506 100644
--- a/src/gui/MachinaGUI.hpp
+++ b/src/gui/MachinaGUI.hpp
@@ -59,6 +59,7 @@ protected:
void show_messages_toggled();
void menu_view_refresh();
void menu_help_about();
+ void menu_help_help();
void zoom(double z);
void zoom_changed();
bool idle_callback();
@@ -80,11 +81,13 @@ protected:
Gtk::Main* _gtk_main;
Gtk::Window* _main_window;
+ Gtk::Dialog* _help_dialog;
Gtk::AboutDialog* _about_window;
Gtk::MenuItem* _menu_file_quit;
+ Gtk::MenuItem* _menu_help_about;
Gtk::CheckMenuItem* _menu_view_messages;
Gtk::MenuItem* _menu_view_refresh;
- Gtk::MenuItem* _menu_help_about;
+ Gtk::MenuItem* _menu_help_help;
Gtk::ScrolledWindow* _canvas_scrolledwindow;
Gtk::TextView* _status_text;
Gtk::Paned* _main_paned;
diff --git a/src/gui/machina.glade b/src/gui/machina.glade
index e1f6fa0..3216b96 100644
--- a/src/gui/machina.glade
+++ b/src/gui/machina.glade
@@ -146,6 +146,15 @@
<widget class="GtkMenu" id="help_menu_menu">
<child>
+ <widget class="GtkImageMenuItem" id="help_help_menuitem">
+ <property name="visible">True</property>
+ <property name="label">gtk-help</property>
+ <property name="use_stock">True</property>
+ <signal name="activate" handler="on_help_about_menuitem_activate" last_modification_time="Sun, 11 Feb 2007 03:43:07 GMT"/>
+ </widget>
+ </child>
+
+ <child>
<widget class="GtkImageMenuItem" id="help_about_menuitem">
<property name="visible">True</property>
<property name="label">gtk-about</property>
@@ -337,4 +346,88 @@ along with Machina; if not, write to the Free Software Foundation, Inc.,
<property name="logo">machina-icon.svg</property>
</widget>
+<widget class="GtkDialog" id="help_dialog">
+ <property name="border_width">8</property>
+ <property name="title" translatable="yes">Machina Help</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="closebutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-7</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Interface is a bit sketchy still:
+
+- Left click the 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>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">8</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>