ardour
step_entry.h
Go to the documentation of this file.
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_window.h"
31 #include "gtk_pianokeyboard.h"
32 
33 class StepEditor;
34 
35 class StepEntry : public ArdourWindow
36 {
37  public:
39  ~StepEntry ();
40 
41  void note_off_event_handler (int note);
42  void rest_event_handler ();
43 
45  uint8_t note_velocity() const;
46  uint8_t note_channel() const;
47 
48  int current_octave () const { return (int) floor (octave_adjustment.get_value()); }
49 
50  private:
53 
54  Gtk::VBox packer;
55  Gtk::HBox upper_box;
56  Gtk::HBox note_length_box;
57  Gtk::HBox note_velocity_box;
58 
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;
69 
70  Gtk::VBox resync_box;
71  Gtk::Button beat_resync_button;
72  Gtk::Button bar_resync_button;
73  Gtk::Button resync_button;
74 
75  Gtk::Button sustain_button;
76  Gtk::Button rest_button;
77  Gtk::Button grid_rest_button;
78  Gtk::VBox rest_box;
79 
80  Gtk::Button back_button;
81 
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;
90 
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;
99 
100  Gtk::Adjustment channel_adjustment;
101  Gtk::SpinButton channel_spinner;
102 
103  Gtk::Adjustment octave_adjustment;
104  Gtk::SpinButton octave_spinner;
105 
106  Gtk::Adjustment length_divisor_adjustment;
107  Gtk::SpinButton length_divisor_spinner;
108 
109  Gtk::Adjustment velocity_adjustment;
110  Gtk::SpinButton velocity_spinner;
111 
112  Gtk::Adjustment bank_adjustment;
113  Gtk::SpinButton bank_spinner;
114  Gtk::Button bank_button;
115 
116  Gtk::Adjustment program_adjustment;
117  Gtk::SpinButton program_spinner;
118  Gtk::Button program_button;
119 
120  void length_changed ();
121  void velocity_changed ();
122  void velocity_value_change ();
123  void length_value_change ();
124 
126  Gtk::Widget* piano;
128 
129  void bank_click ();
130  void program_click ();
131  void beat_resync_click ();
132  void bar_resync_click ();
133 
134  bool piano_enter_notify_event (GdkEventCrossing *ev);
135  bool on_key_release_event (GdkEventKey*);
136  bool on_key_press_event (GdkEventKey*);
137 
138  void on_show ();
139 
140  /* actions */
141 
142  void register_actions ();
144 
145  void insert_note (uint8_t);
146  void insert_rest ();
147  void insert_grid_rest ();
148 
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 ();
161 
162  void note_length_change (GtkAction*);
163  void note_velocity_change (GtkAction*);
164 
165  bool radio_button_press (GdkEventButton*);
166  bool radio_button_release (GdkEventButton*, Gtk::RadioButton*, int);
167 
168  void load_bindings ();
170 
171  void inc_note_velocity ();
172  void dec_note_velocity ();
173  void next_note_velocity ();
174  void prev_note_velocity ();
175 
176  void inc_note_length ();
177  void dec_note_length ();
178  void next_note_length ();
179  void prev_note_length ();
180 
181  void next_octave ();
182  void prev_octave ();
183 
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); }
196 
197  void dot_change (GtkAction*);
198  void dot_value_change ();
199 
200  void toggle_triplet();
201  void toggle_chord();
202 
203  void do_sustain ();
204  void back();
205  void sync_to_edit_point ();
206 };
207 
208 #endif /* __gtk2_ardour_step_entry_h__ */
Gtk::Adjustment bank_adjustment
Definition: step_entry.h:112
Gtk::ToggleButton restart_button
Definition: step_entry.h:68
Gtk::Adjustment program_adjustment
Definition: step_entry.h:116
Gtk::RadioButton velocity_mf_button
Definition: step_entry.h:95
Gtk::VBox rest_box
Definition: step_entry.h:78
Gtk::ToggleButton triplet_button
Definition: step_entry.h:60
uint8_t _current_note_velocity
Definition: step_entry.h:52
Gtk::ToggleButton dot0_button
Definition: step_entry.h:61
Gtk::Button beat_resync_button
Definition: step_entry.h:71
void octave_6()
Definition: step_entry.h:191
Evoral::Beats note_length()
Definition: step_entry.cc:533
void octave_9()
Definition: step_entry.h:194
void octave_5()
Definition: step_entry.h:190
Gtk::Adjustment channel_adjustment
Definition: step_entry.h:100
void dec_note_velocity()
Definition: step_entry.cc:1088
Gtk::HBox note_length_box
Definition: step_entry.h:56
void toggle_chord()
Definition: step_entry.cc:725
void velocity_value_change()
Definition: step_entry.cc:908
void insert_fsharp()
Definition: step_entry.cc:841
void insert_csharp()
Definition: step_entry.cc:816
void prev_note_length()
Definition: step_entry.cc:1048
PianoKeyboard * _piano
Definition: step_entry.h:125
Gtk::ToggleButton dot3_button
Definition: step_entry.h:64
void bank_click()
Definition: step_entry.cc:784
void octave_2()
Definition: step_entry.h:187
void note_length_change(GtkAction *)
Definition: step_entry.cc:874
Gtk::SpinButton program_spinner
Definition: step_entry.h:117
Gtk::RadioButton velocity_mp_button
Definition: step_entry.h:94
Gtk::RadioButton velocity_p_button
Definition: step_entry.h:93
Gtk::HBox note_velocity_box
Definition: step_entry.h:57
void insert_note(uint8_t)
Definition: step_entry.cc:802
Gtk::Adjustment dot_adjustment
Definition: step_entry.h:65
bool on_key_release_event(GdkEventKey *)
Definition: step_entry.cc:511
void insert_g()
Definition: step_entry.cc:846
Gtk::Adjustment velocity_adjustment
Definition: step_entry.h:109
Gtk::RadioButton velocity_pp_button
Definition: step_entry.h:92
void bar_resync_click()
Definition: step_entry.cc:588
void octave_n(int n)
Definition: step_entry.cc:1146
void dot_change(GtkAction *)
Definition: step_entry.cc:731
void insert_d()
Definition: step_entry.cc:821
void insert_dsharp()
Definition: step_entry.cc:826
void insert_c()
Definition: step_entry.cc:811
Gtk::Adjustment length_divisor_adjustment
Definition: step_entry.h:106
void prev_octave()
Definition: step_entry.cc:1030
void velocity_changed()
Gtk::Adjustment octave_adjustment
Definition: step_entry.h:103
Gtk::VBox packer
Definition: step_entry.h:54
Gtk::SpinButton velocity_spinner
Definition: step_entry.h:110
void note_off_event_handler(int note)
Definition: step_entry.cc:568
Gtk::RadioButton velocity_ppp_button
Definition: step_entry.h:91
void octave_1()
Definition: step_entry.h:186
void on_show()
Definition: step_entry.cc:575
Gtk::ToggleButton dot1_button
Definition: step_entry.h:62
void toggle_triplet()
Definition: step_entry.cc:719
int current_octave() const
Definition: step_entry.h:48
void rest_event_handler()
Definition: step_entry.cc:527
Gtk::RadioButton velocity_ff_button
Definition: step_entry.h:97
bool radio_button_press(GdkEventButton *)
Definition: step_entry.cc:998
void next_note_length()
Definition: step_entry.cc:1064
void insert_grid_rest()
Definition: step_entry.cc:796
Gtk::SpinButton channel_spinner
Definition: step_entry.h:101
Gtk::VBox dot_box1
Definition: step_entry.h:66
uint8_t note_velocity() const
Definition: step_entry.cc:556
Gtk::Button program_button
Definition: step_entry.h:118
Gtk::HBox upper_box
Definition: step_entry.h:55
void octave_3()
Definition: step_entry.h:188
void sync_to_edit_point()
Definition: step_entry.cc:1164
Gtk::Button resync_button
Definition: step_entry.h:73
StepEntry(StepEditor &)
Definition: step_entry.cc:59
void dec_note_length()
Definition: step_entry.cc:1042
void next_note_velocity()
Definition: step_entry.cc:1094
void length_value_change()
Definition: step_entry.cc:953
void insert_b()
Definition: step_entry.cc:868
void octave_7()
Definition: step_entry.h:192
Gtkmm2ext::Bindings bindings
Definition: step_entry.h:169
Gtk::RadioButton length_2_button
Definition: step_entry.h:83
void beat_resync_click()
Definition: step_entry.cc:582
void do_sustain()
Definition: step_entry.cc:1152
void back()
Definition: step_entry.cc:1158
void length_changed()
Definition: step_entry.cc:481
void inc_note_velocity()
Definition: step_entry.cc:1082
void octave_0()
Definition: step_entry.h:185
void inc_note_length()
Definition: step_entry.cc:1036
bool piano_enter_notify_event(GdkEventCrossing *ev)
Evoral::Beats _current_note_length
Definition: step_entry.h:51
Gtk::ToggleButton dot2_button
Definition: step_entry.h:63
void dot_value_change()
Definition: step_entry.cc:740
Gtk::RadioButton length_32_button
Definition: step_entry.h:88
Gtk::RadioButton velocity_f_button
Definition: step_entry.h:96
uint8_t note_channel() const
Definition: step_entry.cc:562
StepEditor * se
Definition: step_entry.h:127
void load_bindings()
Definition: step_entry.cc:705
Gtk::RadioButton velocity_fff_button
Definition: step_entry.h:98
void next_octave()
Definition: step_entry.cc:1024
void prev_note_velocity()
Definition: step_entry.cc:1120
Gtk::Button rest_button
Definition: step_entry.h:76
void insert_asharp()
Definition: step_entry.cc:863
Gtk::Widget * piano
Definition: step_entry.h:126
Gtk::SpinButton length_divisor_spinner
Definition: step_entry.h:107
Gtk::VBox dot_box2
Definition: step_entry.h:67
void program_click()
Definition: step_entry.cc:778
Gtk::ToggleButton chord_button
Definition: step_entry.h:59
void note_velocity_change(GtkAction *)
Definition: step_entry.cc:891
Gtk::Button bank_button
Definition: step_entry.h:114
void insert_gsharp()
Definition: step_entry.cc:851
bool on_key_press_event(GdkEventKey *)
Definition: step_entry.cc:493
Gtkmm2ext::ActionMap myactions
Definition: step_entry.h:143
void insert_a()
Definition: step_entry.cc:857
Gtk::Button back_button
Definition: step_entry.h:80
Gtk::RadioButton length_8_button
Definition: step_entry.h:85
Gtk::RadioButton length_1_button
Definition: step_entry.h:82
void register_actions()
Definition: step_entry.cc:594
Gtk::VBox resync_box
Definition: step_entry.h:70
void insert_f()
Definition: step_entry.cc:836
Gtk::SpinButton octave_spinner
Definition: step_entry.h:104
void insert_e()
Definition: step_entry.cc:831
void octave_8()
Definition: step_entry.h:193
Gtk::RadioButton length_16_button
Definition: step_entry.h:87
Gtk::SpinButton bank_spinner
Definition: step_entry.h:113
Gtk::RadioButton length_12_button
Definition: step_entry.h:86
Gtk::RadioButton length_64_button
Definition: step_entry.h:89
void insert_rest()
Definition: step_entry.cc:790
Gtk::Button bar_resync_button
Definition: step_entry.h:72
void octave_4()
Definition: step_entry.h:189
void octave_10()
Definition: step_entry.h:195
Gtk::Button grid_rest_button
Definition: step_entry.h:77
Gtk::RadioButton length_4_button
Definition: step_entry.h:84
Gtk::Button sustain_button
Definition: step_entry.h:75
bool radio_button_release(GdkEventButton *, Gtk::RadioButton *, int)
Definition: step_entry.cc:1008