ardour
note_select_dialog.cc
Go to the documentation of this file.
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 "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 
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);
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
52 {
53  printf("NOTE: %d\n", note);
54  _note_number = note;
55 }
void piano_keyboard_set_monophonic(PianoKeyboard *pk, gboolean monophonic)
GtkWidget * piano_keyboard_new(void)
#define _(Text)
Definition: i18n.h:11
static void _note_on_event_handler(GtkWidget *, int note, gpointer arg)
void piano_keyboard_sustain_press(PianoKeyboard *pk)
PianoKeyboard * _piano
void note_on_event_handler(int note)
Gtk::Widget * _pianomm