diff options
author | David Robillard <d@drobilla.net> | 2014-11-03 16:37:19 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-11-03 16:37:19 -0500 |
commit | 35672fb80a2258b01da60ba9514266b94c1493ff (patch) | |
tree | 34bc78495a708078321696cf7acb11b89d470a94 /gtk2_ardour/note_select_dialog.cc | |
parent | 7204702c3ffbd3a1c6747511104d9c6af1b9c93d (diff) |
Note selector dialog for note controls.
Diffstat (limited to 'gtk2_ardour/note_select_dialog.cc')
-rw-r--r-- | gtk2_ardour/note_select_dialog.cc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/gtk2_ardour/note_select_dialog.cc b/gtk2_ardour/note_select_dialog.cc new file mode 100644 index 0000000000..14d45ccf5a --- /dev/null +++ b/gtk2_ardour/note_select_dialog.cc @@ -0,0 +1,55 @@ +/* + Copyright (C) 2014 Paul Davis + Author: David Robillard + + This program 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 + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <gtkmm/stock.h> + +#include "note_select_dialog.h" + +#include "i18n.h" + +static void +_note_on_event_handler(GtkWidget* /*widget*/, int note, gpointer arg) +{ + ((NoteSelectDialog*)arg)->note_on_event_handler(note); +} + +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); + + 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) +{ + printf("NOTE: %d\n", note); + _note_number = note; +} |