first, incomplete pass at step entry dialog, along with various SVG and PNG files...
[ardour.git] / gtk2_ardour / gtk_pianokeyboard.h
1 #ifndef __PIANO_KEYBOARD_H__
2 #define __PIANO_KEYBOARD_H__
3
4 #include <glib.h>
5 #include <gtk/gtkdrawingarea.h>
6
7 G_BEGIN_DECLS
8
9 #define TYPE_PIANO_KEYBOARD                     (piano_keyboard_get_type ())
10 #define PIANO_KEYBOARD(obj)                     (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PIANO_KEYBOARD, PianoKeyboard))
11 #define PIANO_KEYBOARD_CLASS(klass)             (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PIANO_KEYBOARD, PianoKeyboardClass))
12 #define IS_PIANO_KEYBOARD(obj)                  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PIANO_KEYBOARD))
13 #define IS_PIANO_KEYBOARD_CLASS(klass)          (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PIANO_KEYBOARD))
14 #define PIANO_KEYBOARD_GET_CLASS(obj)           (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PIANO_KEYBOARD, PianoKeyboardClass))
15
16 typedef struct  _PianoKeyboard                  PianoKeyboard;
17 typedef struct  _PianoKeyboardClass             PianoKeyboardClass;
18
19 #define NNOTES                  127
20
21 #define OCTAVE_MIN      -1
22 #define OCTAVE_MAX      7
23
24 struct Note {
25         int                     pressed;                /* 1 if key is in pressed down state. */
26         int                     sustained;              /* 1 if note is sustained. */
27         int                     x;                      /* Distance between the left edge of the key
28                                                          * and the left edge of the widget, in pixels. */
29         int                     w;                      /* Width of the key, in pixels. */
30         int                     h;                      /* Height of the key, in pixels. */
31         int                     white;                  /* 1 if key is white; 0 otherwise. */
32 };
33
34 struct _PianoKeyboard
35 {
36         GtkDrawingArea          da;
37         int                     maybe_stop_sustained_notes;
38         int                     sustain_new_notes;
39         int                     enable_keyboard_cue;
40         int                     octave;
41         int                     widget_margin;
42         int                     note_being_pressed_using_mouse;
43         volatile struct Note    notes[NNOTES];
44         /* Table used to translate from PC keyboard character to MIDI note number. */
45         GHashTable              *key_bindings;
46 };
47
48 struct _PianoKeyboardClass
49 {
50         GtkDrawingAreaClass     parent_class;
51 };
52
53 GType           piano_keyboard_get_type         (void) G_GNUC_CONST;
54 GtkWidget*      piano_keyboard_new              (void);
55 void            piano_keyboard_sustain_press    (PianoKeyboard *pk);
56 void            piano_keyboard_sustain_release  (PianoKeyboard *pk);
57 void            piano_keyboard_set_note_on      (PianoKeyboard *pk, int note);
58 void            piano_keyboard_set_note_off     (PianoKeyboard *pk, int note);
59 void            piano_keyboard_set_keyboard_cue (PianoKeyboard *pk, int enabled);
60 void            piano_keyboard_set_octave (PianoKeyboard *pk, int octave);
61 gboolean        piano_keyboard_set_keyboard_layout (PianoKeyboard *pk, const char *layout);
62
63 G_END_DECLS
64
65 #endif /* __PIANO_KEYBOARD_H__ */
66