#include <gtkmm/box.h>
#include <gtkmm/spinbutton.h>
-#include "pbd/signals.h"
#include "pbd/controllable.h"
+#include "pbd/signals.h"
+
+#include "gtkmm2ext/persistent_tooltip.h"
#include "widgets/ardour_button.h"
#include "widgets/ardour_dropdown.h"
#include "widgets/ardour_knob.h"
+#include "widgets/slider_controller.h"
#include "ardour_window.h"
-#include "gtk_pianokeyboard.h"
+#include "pianokeyboard.h"
namespace ARDOUR {
class Session;
}
-class VKBDControl : public PBD::Controllable {
+class VKBDControl : public PBD::Controllable
+{
public:
- VKBDControl (const std::string& name, double normal = 127)
- : PBD::Controllable (name, Flag(0))
+ VKBDControl (const std::string& name, double normal = 127, double upper = 127)
+ : PBD::Controllable (name, Flag (0))
, _lower (0)
- , _upper (127)
+ , _upper (upper)
, _normal (normal)
, _value (normal)
{}
/* Controllable API */
- void set_value (double v, PBD::Controllable::GroupControlDisposition gcd) {
+ void set_value (double v, PBD::Controllable::GroupControlDisposition gcd)
+ {
if (v != _value) {
_value = std::max (_lower, std::min (_upper, v));
- Changed (true, gcd); /* EMIT SIGNAL */
+ Changed (true, gcd); /* EMIT SIGNAL */
ValueChanged ((int)_value); /* EMIT SIGNAL */
}
}
- double get_value () const {
- return _value;
- }
-
std::string get_user_string () const
{
char buf[32];
- sprintf (buf, "%.0f", get_value());
- return std::string(buf);
+ sprintf (buf, "%.0f", get_value ());
+ return std::string (buf);
}
+ double get_value () const { return _value; }
double lower () const { return _lower; }
double upper () const { return _upper; }
double normal () const { return _normal; }
double _value;
};
-
class VirtualKeyboardWindow : public ArdourWindow
{
public:
VirtualKeyboardWindow ();
~VirtualKeyboardWindow ();
-private:
- static void _note_on_event_handler (GtkWidget*, int note, int vel, gpointer arg)
- {
- static_cast<VirtualKeyboardWindow*>(arg)->note_on_event_handler(note, vel);
- }
+ void set_session (ARDOUR::Session*);
- static void _note_off_event_handler (GtkWidget*, int note, gpointer arg)
- {
- static_cast<VirtualKeyboardWindow*>(arg)->note_off_event_handler(note);
- }
+ XMLNode& get_state ();
+ void set_state (const XMLNode&);
+
+protected:
+ bool on_focus_in_event (GdkEventFocus*);
+private:
void on_unmap ();
bool on_key_press_event (GdkEventKey*);
+ bool on_key_release_event (GdkEventKey*);
- void note_on_event_handler (int, int);
+ void note_on_event_handler (int, int);
void note_off_event_handler (int);
void control_change_event_handler (int, int);
- void select_keyboard_layout (int);
+ void octave_key_event_handler (bool);
+ void pitch_bend_key_event_handler (int, bool);
+ bool pitch_bend_timeout ();
+
+ void pitch_bend_event_handler (int);
+ void pitch_bend_release ();
+ void pitch_bend_update_tooltip (int);
+ void pitch_slider_adjusted ();
+
+ void select_keyboard_layout (std::string const&);
void update_velocity_settings (int);
+ void update_octave_key ();
+ void update_octave_range ();
void bank_patch ();
void update_sensitivity ();
bool toggle_config (GdkEventButton*);
bool toggle_yaxis_velocity (GdkEventButton*);
bool send_panic_message (GdkEventButton*);
- PianoKeyboard* _piano;
- Gtk::Widget* _pianomm;
- Gtk::SpinButton _piano_channel;
+ APianoKeyboard _piano;
+
+ ArdourWidgets::ArdourDropdown _midi_channel;
+ ArdourWidgets::ArdourDropdown _transpose_output;
Gtk::SpinButton _bank_msb;
Gtk::SpinButton _bank_lsb;
ArdourWidgets::ArdourButton _yaxis_velocity;
ArdourWidgets::ArdourButton _send_panic;
ArdourWidgets::ArdourDropdown _keyboard_layout;
+ ArdourWidgets::ArdourDropdown _keyboard_annotations;
Gtk::SpinButton _piano_key_velocity;
Gtk::SpinButton _piano_min_velocity;
Gtk::SpinButton _piano_max_velocity;
+ Gtk::SpinButton _piano_octave_key;
+ Gtk::SpinButton _piano_octave_range;
+
+ boost::shared_ptr<VKBDControl> _pitchbend;
+ Gtk::Adjustment _pitch_adjustment;
+ ArdourWidgets::VSliderController* _pitch_slider;
+ Gtkmm2ext::PersistentTooltip* _pitch_slider_tooltip;
+
#define VKBD_NCTRLS 8
boost::shared_ptr<VKBDControl> _cc[VKBD_NCTRLS];
ArdourWidgets::ArdourDropdown _cc_key[VKBD_NCTRLS];
PBD::ScopedConnectionList _cc_connections;
+
+ sigc::connection _bender_connection;
+ int _pitch_bend_target;
};
#endif