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 MidiTimeAxisView
;
35 class StepEntry
: public ArdourDialog
38 StepEntry (MidiTimeAxisView
&);
41 void note_off_event_handler (int note
);
42 void rest_event_handler ();
44 Evoral::MusicalTime
note_length() const;
45 uint8_t note_velocity() const;
46 uint8_t note_channel() const;
48 int current_octave () const { return (int) floor (octave_adjustment
.get_value()); }
51 Evoral::MusicalTime _current_note_length
;
52 uint8_t _current_note_velocity
;
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 dot_button
;
62 Gtk::ToggleButton restart_button
;
65 Gtk::Button beat_resync_button
;
66 Gtk::Button bar_resync_button
;
68 Gtk::Button sustain_button
;
69 Gtk::Button rest_button
;
70 Gtk::Button grid_rest_button
;
73 Gtk::RadioButton length_1_button
;
74 Gtk::RadioButton length_2_button
;
75 Gtk::RadioButton length_4_button
;
76 Gtk::RadioButton length_8_button
;
77 Gtk::RadioButton length_12_button
;
78 Gtk::RadioButton length_16_button
;
79 Gtk::RadioButton length_32_button
;
80 Gtk::RadioButton length_64_button
;
82 Gtk::RadioButton velocity_ppp_button
;
83 Gtk::RadioButton velocity_pp_button
;
84 Gtk::RadioButton velocity_p_button
;
85 Gtk::RadioButton velocity_mp_button
;
86 Gtk::RadioButton velocity_mf_button
;
87 Gtk::RadioButton velocity_f_button
;
88 Gtk::RadioButton velocity_ff_button
;
89 Gtk::RadioButton velocity_fff_button
;
91 Gtk::Adjustment channel_adjustment
;
92 Gtk::SpinButton channel_spinner
;
94 Gtk::Adjustment octave_adjustment
;
95 Gtk::SpinButton octave_spinner
;
97 Gtk::Adjustment length_divisor_adjustment
;
98 Gtk::SpinButton length_divisor_spinner
;
100 Gtk::Adjustment velocity_adjustment
;
101 Gtk::SpinButton velocity_spinner
;
103 void length_changed ();
104 void velocity_changed ();
105 void velocity_value_change ();
106 void length_value_change ();
108 PianoKeyboard
* _piano
;
110 MidiTimeAxisView
* _mtv
;
113 void grid_rest_click ();
114 void sustain_click ();
115 void chord_toggled ();
116 void triplet_toggled ();
117 void beat_resync_click ();
118 void bar_resync_click ();
120 bool piano_enter_notify_event (GdkEventCrossing
*ev
);
121 bool on_key_release_event (GdkEventKey
*);
122 bool on_key_press_event (GdkEventKey
*);
128 void register_actions ();
129 Gtkmm2ext::ActionMap myactions
;
131 void insert_note (uint8_t);
133 void insert_grid_rest ();
136 void insert_asharp ();
139 void insert_csharp ();
141 void insert_dsharp ();
144 void insert_fsharp ();
146 void insert_gsharp ();
148 void note_length_change (GtkAction
*);
149 void note_velocity_change (GtkAction
*);
151 bool radio_button_press (GdkEventButton
*);
152 bool radio_button_release (GdkEventButton
*, Gtk::RadioButton
*, int);
154 void load_bindings ();
155 Gtkmm2ext::Bindings bindings
;
158 #endif /* __gtk2_ardour_step_entry_h__ */