7b1fd89f727f6eb0cf654ef342f9e6ceb90cc326
[ardour.git] / gtk2_ardour / step_entry.h
1 /*
2     Copyright (C) 2010 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __gtk2_ardour_step_entry_h__
21 #define __gtk2_ardour_step_entry_h__
22
23 #include <gtkmm/togglebutton.h>
24 #include <gtkmm/radiobutton.h>
25 #include <gtkmm/spinbutton.h>
26 #include <gtkmm/box.h>
27 #include <gtkmm/adjustment.h>
28 #include <gtkmm2ext/bindings.h>
29
30 #include "ardour_dialog.h"
31 #include "gtk_pianokeyboard.h"
32
33 class MidiTimeAxisView;
34
35 class StepEntry : public ArdourDialog
36 {
37   public:
38         StepEntry (MidiTimeAxisView&);
39         ~StepEntry ();
40
41         void note_off_event_handler (int note);
42         void rest_event_handler ();
43
44         Evoral::MusicalTime note_length() const;
45         uint8_t note_velocity() const;
46         uint8_t note_channel() const;
47
48   private:
49         Gtk::VBox packer;
50         Gtk::HBox upper_box;
51         Gtk::HBox note_length_box;
52         Gtk::HBox note_velocity_box;
53
54         Gtk::ToggleButton chord_button;
55         Gtk::ToggleButton triplet_button;
56         Gtk::ToggleButton dot_button;
57         Gtk::ToggleButton restart_button;
58
59         Gtk::VBox   resync_box;
60         Gtk::Button beat_resync_button;
61         Gtk::Button bar_resync_button;
62
63         Gtk::Button sustain_button;
64         Gtk::Button rest_button;
65         Gtk::Button grid_rest_button;
66         Gtk::VBox   rest_box;
67
68         Gtk::RadioButton length_1_button;
69         Gtk::RadioButton length_2_button;
70         Gtk::RadioButton length_4_button;
71         Gtk::RadioButton length_8_button;
72         Gtk::RadioButton length_12_button;
73         Gtk::RadioButton length_16_button;
74         Gtk::RadioButton length_32_button;
75         Gtk::RadioButton length_64_button;
76
77         Gtk::RadioButton velocity_ppp_button;
78         Gtk::RadioButton velocity_pp_button;
79         Gtk::RadioButton velocity_p_button;
80         Gtk::RadioButton velocity_mp_button;
81         Gtk::RadioButton velocity_mf_button;
82         Gtk::RadioButton velocity_f_button;
83         Gtk::RadioButton velocity_ff_button;
84         Gtk::RadioButton velocity_fff_button;
85
86         Gtk::Adjustment channel_adjustment;
87         Gtk::SpinButton channel_spinner;
88
89         PianoKeyboard* _piano;
90         Gtk::Widget* piano;
91         MidiTimeAxisView* _mtv;
92
93         void rest_click ();
94         void grid_rest_click ();
95         void sustain_click ();
96         void chord_toggled ();
97         void triplet_toggled ();
98         void beat_resync_click ();
99         void bar_resync_click ();
100
101         bool piano_enter_notify_event (GdkEventCrossing *ev);
102         bool on_key_release_event (GdkEventKey*);
103         bool on_key_press_event (GdkEventKey*);
104
105         void on_show ();
106
107         /* actions */
108
109         void register_actions ();
110         Gtkmm2ext::ActionMap myactions;
111
112         void insert_a ();
113         void insert_asharp ();
114         void insert_b ();
115         void insert_bsharp ();
116         void insert_c ();
117         void insert_csharp ();
118         void insert_d ();
119         void insert_dsharp ();
120         void insert_e ();
121         void insert_f ();
122         void insert_fsharp ();
123         void insert_g ();
124         
125         void note_length_whole ();
126         void note_length_half ();
127         void note_length_quarter ();
128         void note_length_eighth ();
129         void note_length_sixteenth ();
130         void note_length_thirtysecond ();
131         void note_length_sixtyfourth ();
132
133         void note_velocity_ppp ();
134         void note_velocity_pp ();
135         void note_velocity_p ();
136         void note_velocity_mp ();
137         void note_velocity_mf ();
138         void note_velocity_f ();
139         void note_velocity_ff ();
140         void note_velocity_fff ();
141
142         void load_bindings ();
143         Gtkmm2ext::Bindings  bindings;
144 };
145
146 #endif /* __gtk2_ardour_step_entry_h__ */