Reenable the correct sort column and type when redisplaying regions
[ardour.git] / gtk2_ardour / virtual_keyboard_window.h
index e60dc91e3b0c601a607e9ea0bee2143763b713bf..f0f6f27bd807af65c98e3ae8f45de3f3489ab0a8 100644 (file)
@@ -22,8 +22,8 @@
 #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/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, double upper = 127)
-               : PBD::Controllable (name, Flag(0))
+               : PBD::Controllable (name, Flag (0))
                , _lower (0)
                , _upper (upper)
                , _normal (normal)
@@ -50,25 +51,23 @@ public:
        {}
 
        /* 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; }
@@ -82,7 +81,6 @@ protected:
        double _value;
 };
 
-
 class VirtualKeyboardWindow : public ArdourWindow
 {
 public:
@@ -92,81 +90,72 @@ public:
        void set_session (ARDOUR::Session*);
 
        XMLNode& get_state ();
-       void set_state (const XMLNode &);
+       void     set_state (const XMLNode&);
 
-private:
-       static void _note_on_event_handler (GtkWidget*, int note, int vel, gpointer arg)
-       {
-               static_cast<VirtualKeyboardWindow*>(arg)->note_on_event_handler(note, vel);
-       }
-
-       static void _note_off_event_handler (GtkWidget*, int note, gpointer arg) 
-       {
-               static_cast<VirtualKeyboardWindow*>(arg)->note_off_event_handler(note);
-       }
+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 parameter_changed (std::string const&);
+
+       void note_on_event_handler (int, int);
        void note_off_event_handler (int);
        void control_change_event_handler (int, int);
+       void control_change_knob_event_handler (int, int);
+
+       void modwheel_update_tooltip (int);
+       void modwheel_slider_adjusted ();
+
+       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_velocity_settings ();
        void update_octave_key ();
        void update_octave_range ();
-       void bank_patch ();
-       void update_sensitivity ();
-       void pitch_slider_adjusted ();
-       bool toggle_config (GdkEventButton*);
-       bool toggle_bankpatch (GdkEventButton*);
-       bool toggle_yaxis_velocity (GdkEventButton*);
-       bool toggle_highlight_piano (GdkEventButton*);
-       bool toggle_highlight_key (GdkEventButton*);
-       bool toggle_note_label (GdkEventButton*);
+       void cc_key_changed (size_t);
+       void update_cc (size_t, int);
        bool send_panic_message (GdkEventButton*);
+       bool on_velocity_scroll_event (GdkEventScroll*);
 
-       PianoKeyboard*  _piano;
-       Gtk::Widget*    _pianomm;
-       Gtk::SpinButton _piano_channel;
-
-       Gtk::SpinButton _bank_msb;
-       Gtk::SpinButton _bank_lsb;
-       Gtk::SpinButton _patchpgm;
-
-       Gtk::HBox* _cfg_box;
-       Gtk::HBox* _pgm_box;
+       APianoKeyboard  _piano;
 
-       ArdourWidgets::ArdourButton   _cfg_display;
-       ArdourWidgets::ArdourButton   _pgm_display;
-       ArdourWidgets::ArdourButton   _yaxis_velocity;
-       ArdourWidgets::ArdourButton   _highlight_grand_piano;
-       ArdourWidgets::ArdourButton   _highlight_key_range;
-       ArdourWidgets::ArdourButton   _show_note_label;
-       ArdourWidgets::ArdourButton   _send_panic;
-       ArdourWidgets::ArdourDropdown _keyboard_layout;
-
-       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;
+       ArdourWidgets::ArdourDropdown  _midi_channel;
+       ArdourWidgets::ArdourDropdown  _piano_velocity;
+       ArdourWidgets::ArdourDropdown  _piano_octave_key;
+       ArdourWidgets::ArdourDropdown  _piano_octave_range;
+       ArdourWidgets::ArdourDropdown  _transpose_output;
+       ArdourWidgets::ArdourButton    _send_panic;
 
        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>    _modwheel;
+       Gtk::Adjustment                   _modwheel_adjustment;
+       ArdourWidgets::VSliderController* _modwheel_slider;
+       Gtkmm2ext::PersistentTooltip*     _modwheel_tooltip;
+#define VKBD_NCTRLS 4
 
        boost::shared_ptr<VKBDControl> _cc[VKBD_NCTRLS];
        ArdourWidgets::ArdourKnob*     _cc_knob[VKBD_NCTRLS];
        ArdourWidgets::ArdourDropdown  _cc_key[VKBD_NCTRLS];
 
        PBD::ScopedConnectionList _cc_connections;
+
+       sigc::connection _bender_connection;
+       int              _pitch_bend_target;
 };
 
 #endif