summaryrefslogtreecommitdiff
path: root/gtk2_ardour/note_select_dialog.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-10-24 19:43:46 +0200
committerRobin Gareus <robin@gareus.org>2019-10-24 19:59:22 +0200
commit3f2f5172915973a98b550c70cabbe979553664b2 (patch)
tree7713bf254c2128d586eee0f41f7374fb1cd46a70 /gtk2_ardour/note_select_dialog.cc
parent7664f8fd29793be09899cd1c94695a2a3880215f (diff)
Rough-in gtk-pianokeyboard C -> C++
Diffstat (limited to 'gtk2_ardour/note_select_dialog.cc')
-rw-r--r--gtk2_ardour/note_select_dialog.cc27
1 files changed, 10 insertions, 17 deletions
diff --git a/gtk2_ardour/note_select_dialog.cc b/gtk2_ardour/note_select_dialog.cc
index 3a9dfa35e7..36aae45db6 100644
--- a/gtk2_ardour/note_select_dialog.cc
+++ b/gtk2_ardour/note_select_dialog.cc
@@ -23,33 +23,26 @@
#include "pbd/i18n.h"
-static void
-_note_on_event_handler(GtkWidget* /*widget*/, int note, int, gpointer arg)
-{
- ((NoteSelectDialog*)arg)->note_on_event_handler(note);
-}
-
-NoteSelectDialog::NoteSelectDialog()
+NoteSelectDialog::NoteSelectDialog ()
: ArdourDialog (_("Select Note"))
- , _piano((PianoKeyboard*)piano_keyboard_new())
- , _pianomm(Glib::wrap((GtkWidget*)_piano))
, _note_number(60)
{
- _pianomm->set_flags(Gtk::CAN_FOCUS);
- _pianomm->show();
- g_signal_connect(G_OBJECT(_piano), "note-on", G_CALLBACK(_note_on_event_handler), this);
- piano_keyboard_set_monophonic(_piano, TRUE);
- piano_keyboard_sustain_press(_piano);
+ _piano.set_flags(Gtk::CAN_FOCUS);
+ _piano.show();
+ _piano.NoteOn.connect (sigc::mem_fun (*this, &NoteSelectDialog::note_on_event_handler));
+
+ _piano.set_monophonic (true);
+ _piano.sustain_press ();
+
+ get_vbox()->pack_start(_piano);
- get_vbox()->pack_start(*_pianomm);
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
set_default_response(Gtk::RESPONSE_ACCEPT);
}
void
-NoteSelectDialog::note_on_event_handler(int note)
+NoteSelectDialog::note_on_event_handler(int note, int)
{
- printf("NOTE: %d\n", note);
_note_number = note;
}