summaryrefslogtreecommitdiff
path: root/gtk2_ardour/step_entry.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-08-03 19:22:57 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-08-03 19:22:57 +0000
commitb1f5a6a68d0b62a61684b2c011a97de825256a59 (patch)
tree856af95d148d2c0b395fac1d3483159d54ee5253 /gtk2_ardour/step_entry.cc
parentbd69ec8b25e825e0bf6399e19e34e553189a0c28 (diff)
a bunch of tweaks for the step entry process (computer keyboard input now works, for example)
git-svn-id: svn://localhost/ardour2/branches/3.0@7532 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/step_entry.cc')
-rw-r--r--gtk2_ardour/step_entry.cc46
1 files changed, 44 insertions, 2 deletions
diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc
index 09bdb076d2..f585cba057 100644
--- a/gtk2_ardour/step_entry.cc
+++ b/gtk2_ardour/step_entry.cc
@@ -19,6 +19,8 @@
#include <iostream>
+#include "gtkmm2ext/keyboard.h"
+
#include "midi_time_axis.h"
#include "step_entry.h"
#include "utils.h"
@@ -33,9 +35,14 @@ _note_off_event_handler (GtkWidget* widget, int note, gpointer arg)
((StepEntry*)arg)->note_off_event_handler (note);
}
+static void
+_rest_event_handler (GtkWidget* widget, gpointer arg)
+{
+ ((StepEntry*)arg)->rest_event_handler ();
+}
StepEntry::StepEntry (MidiTimeAxisView& mtv)
- : ArdourDialog (_("Step Entry Editor"))
+ : ArdourDialog (string_compose (_("Step Entry: %1"), mtv.name()))
, triplet_button ("3")
, sustain_button ("sustain")
, rest_button ("rest")
@@ -166,10 +173,15 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv)
upper_box.pack_start (channel_spinner, false, false);
_piano = (PianoKeyboard*) piano_keyboard_new ();
- piano = Glib::wrap ((GtkWidget*) _piano);
piano_keyboard_set_keyboard_cue (PIANO_KEYBOARD(_piano), 1);
+
+ piano = Glib::wrap ((GtkWidget*) _piano);
+
+ piano->set_flags (Gtk::CAN_FOCUS);
+ piano->signal_enter_notify_event().connect (sigc::mem_fun (*this, &StepEntry::piano_enter_notify_event), false);
g_signal_connect(G_OBJECT(_piano), "note-off", G_CALLBACK(_note_off_event_handler), this);
+ g_signal_connect(G_OBJECT(_piano), "rest", G_CALLBACK(_rest_event_handler), this);
rest_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::rest_click));
chord_button.signal_toggled().connect (sigc::mem_fun (*this, &StepEntry::chord_toggled));
@@ -187,6 +199,28 @@ StepEntry::~StepEntry()
{
}
+bool
+StepEntry::on_key_press_event (GdkEventKey* ev)
+{
+ int ret;
+ g_signal_emit_by_name (G_OBJECT(_piano), "key-press-event", ev, &ret);
+ return ret;
+}
+
+bool
+StepEntry::on_key_release_event (GdkEventKey* ev)
+{
+ int ret;
+ g_signal_emit_by_name (G_OBJECT(_piano), "key-release-event", ev, &ret);
+ return ret;
+}
+
+void
+StepEntry::rest_event_handler ()
+{
+ _mtv->step_edit_rest();
+}
+
void
StepEntry::note_off_event_handler (int note)
{
@@ -259,3 +293,11 @@ StepEntry::chord_toggled ()
_mtv->step_edit_toggle_chord ();
}
}
+
+bool
+StepEntry::piano_enter_notify_event (GdkEventCrossing *ev)
+{
+ piano->grab_focus ();
+ return false;
+}
+