its about that time
[ardour2.git] / gtk2_ardour / step_entry.h
blobe534c83e0148235fe57433cd97325c1350290b74
1 /*
2 Copyright (C) 2010 Paul Davis
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.
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.
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.
20 #ifndef __gtk2_ardour_step_entry_h__
21 #define __gtk2_ardour_step_entry_h__
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>
30 #include "ardour_dialog.h"
31 #include "gtk_pianokeyboard.h"
33 class StepEditor;
35 class StepEntry : public ArdourDialog
37 public:
38 StepEntry (StepEditor&);
39 ~StepEntry ();
41 void note_off_event_handler (int note);
42 void rest_event_handler ();
44 Evoral::MusicalTime note_length();
45 uint8_t note_velocity() const;
46 uint8_t note_channel() const;
48 int current_octave () const { return (int) floor (octave_adjustment.get_value()); }
50 private:
51 Evoral::MusicalTime _current_note_length;
52 uint8_t _current_note_velocity;
54 Gtk::VBox packer;
55 Gtk::HBox upper_box;
56 Gtk::HBox note_length_box;
57 Gtk::HBox note_velocity_box;
59 Gtk::ToggleButton chord_button;
60 Gtk::ToggleButton triplet_button;
61 Gtk::ToggleButton dot0_button;
62 Gtk::ToggleButton dot1_button;
63 Gtk::ToggleButton dot2_button;
64 Gtk::ToggleButton dot3_button;
65 Gtk::Adjustment dot_adjustment;
66 Gtk::VBox dot_box1;
67 Gtk::VBox dot_box2;
68 Gtk::ToggleButton restart_button;
70 Gtk::VBox resync_box;
71 Gtk::Button beat_resync_button;
72 Gtk::Button bar_resync_button;
73 Gtk::Button resync_button;
75 Gtk::Button sustain_button;
76 Gtk::Button rest_button;
77 Gtk::Button grid_rest_button;
78 Gtk::VBox rest_box;
80 Gtk::Button back_button;
82 Gtk::RadioButton length_1_button;
83 Gtk::RadioButton length_2_button;
84 Gtk::RadioButton length_4_button;
85 Gtk::RadioButton length_8_button;
86 Gtk::RadioButton length_12_button;
87 Gtk::RadioButton length_16_button;
88 Gtk::RadioButton length_32_button;
89 Gtk::RadioButton length_64_button;
91 Gtk::RadioButton velocity_ppp_button;
92 Gtk::RadioButton velocity_pp_button;
93 Gtk::RadioButton velocity_p_button;
94 Gtk::RadioButton velocity_mp_button;
95 Gtk::RadioButton velocity_mf_button;
96 Gtk::RadioButton velocity_f_button;
97 Gtk::RadioButton velocity_ff_button;
98 Gtk::RadioButton velocity_fff_button;
100 Gtk::Adjustment channel_adjustment;
101 Gtk::SpinButton channel_spinner;
103 Gtk::Adjustment octave_adjustment;
104 Gtk::SpinButton octave_spinner;
106 Gtk::Adjustment length_divisor_adjustment;
107 Gtk::SpinButton length_divisor_spinner;
109 Gtk::Adjustment velocity_adjustment;
110 Gtk::SpinButton velocity_spinner;
112 Gtk::Adjustment bank_adjustment;
113 Gtk::SpinButton bank_spinner;
114 Gtk::Button bank_button;
116 Gtk::Adjustment program_adjustment;
117 Gtk::SpinButton program_spinner;
118 Gtk::Button program_button;
120 void length_changed ();
121 void velocity_changed ();
122 void velocity_value_change ();
123 void length_value_change ();
125 PianoKeyboard* _piano;
126 Gtk::Widget* piano;
127 StepEditor* se;
129 void bank_click ();
130 void program_click ();
131 void beat_resync_click ();
132 void bar_resync_click ();
134 bool piano_enter_notify_event (GdkEventCrossing *ev);
135 bool on_key_release_event (GdkEventKey*);
136 bool on_key_press_event (GdkEventKey*);
138 void on_show ();
140 /* actions */
142 void register_actions ();
143 Gtkmm2ext::ActionMap myactions;
145 void insert_note (uint8_t);
146 void insert_rest ();
147 void insert_grid_rest ();
149 void insert_a ();
150 void insert_asharp ();
151 void insert_b ();
152 void insert_c ();
153 void insert_csharp ();
154 void insert_d ();
155 void insert_dsharp ();
156 void insert_e ();
157 void insert_f ();
158 void insert_fsharp ();
159 void insert_g ();
160 void insert_gsharp ();
162 void note_length_change (GtkAction*);
163 void note_velocity_change (GtkAction*);
165 bool radio_button_press (GdkEventButton*);
166 bool radio_button_release (GdkEventButton*, Gtk::RadioButton*, int);
168 void load_bindings ();
169 Gtkmm2ext::Bindings bindings;
171 void inc_note_velocity ();
172 void dec_note_velocity ();
173 void next_note_velocity ();
174 void prev_note_velocity ();
176 void inc_note_length ();
177 void dec_note_length ();
178 void next_note_length ();
179 void prev_note_length ();
181 void next_octave ();
182 void prev_octave ();
184 void octave_n (int n);
185 void octave_0 () { octave_n (0); }
186 void octave_1 () { octave_n (1); }
187 void octave_2 () { octave_n (2); }
188 void octave_3 () { octave_n (3); }
189 void octave_4 () { octave_n (4); }
190 void octave_5 () { octave_n (5); }
191 void octave_6 () { octave_n (6); }
192 void octave_7 () { octave_n (7); }
193 void octave_8 () { octave_n (8); }
194 void octave_9 () { octave_n (9); }
195 void octave_10 () { octave_n (10); }
197 void dot_change (GtkAction*);
198 void dot_value_change ();
200 void toggle_triplet();
201 void toggle_chord();
203 void do_sustain ();
204 void back();
205 void sync_to_edit_point ();
208 #endif /* __gtk2_ardour_step_entry_h__ */