enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / gtk2_ardour / note_select_dialog.cc
1 /*
2   Copyright (C) 2014 Paul Davis
3   Author: David Robillard
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program; if not, write to the Free Software
17   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <gtkmm/stock.h>
21
22 #include "note_select_dialog.h"
23
24 #include "pbd/i18n.h"
25
26 static void
27 _note_on_event_handler(GtkWidget* /*widget*/, int note, gpointer arg)
28 {
29         ((NoteSelectDialog*)arg)->note_on_event_handler(note);
30 }
31
32 NoteSelectDialog::NoteSelectDialog()
33         : ArdourDialog (_("Select Note"))
34         , _piano((PianoKeyboard*)piano_keyboard_new())
35         , _pianomm(Glib::wrap((GtkWidget*)_piano))
36         , _note_number(60)
37 {
38         _pianomm->set_flags(Gtk::CAN_FOCUS);
39         _pianomm->show();
40         g_signal_connect(G_OBJECT(_piano), "note-on", G_CALLBACK(_note_on_event_handler), this);
41         piano_keyboard_set_monophonic(_piano, TRUE);
42         piano_keyboard_sustain_press(_piano);
43
44         get_vbox()->pack_start(*_pianomm);
45         add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
46         add_button(Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
47         set_default_response(Gtk::RESPONSE_ACCEPT);
48 }
49
50 void
51 NoteSelectDialog::note_on_event_handler(int note)
52 {
53         printf("NOTE: %d\n", note);
54         _note_number = note;
55 }