Slightly hacky fix for AFL/PFL button misbehaviour
[ardour.git] / gtk2_ardour / shuttle_control.h
index 4256d87536ca8e8c68c8122715b20d2946f4dd0d..ab58969743bbb5609dafeb9628b4cbb6c6134b2e 100644 (file)
@@ -21,6 +21,8 @@
 
 #include <gtkmm/drawingarea.h>
 
+#include "gtkmm2ext/binding_proxy.h"
+
 #include "pbd/controllable.h"
 #include "ardour/session_handle.h"
 
@@ -30,7 +32,7 @@ namespace Gtk {
 
 #include "ardour/types.h"
 
-class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr 
+class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr
 {
   public:
        ShuttleControl ();
@@ -46,26 +48,26 @@ class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr
                ShuttleControllable (ShuttleControl&);
                void set_value (double);
                double get_value (void) const;
-               
-               void set_id (const std::string&);
-               
+
                ShuttleControl& sc;
        };
 
-       ShuttleControllable& controllable() { return _controllable; }
+       boost::shared_ptr<ShuttleControllable> controllable() const { return _controllable; }
 
   protected:
        float  shuttle_max_speed;
        float  last_speed_displayed;
        bool   shuttle_grabbed;
-       double shuttle_fract;
-       ShuttleControllable _controllable;
+       double shuttle_speed_on_grab;
+       float shuttle_fract;
+       boost::shared_ptr<ShuttleControllable> _controllable;
        cairo_pattern_t* pattern;
        ARDOUR::microseconds_t last_shuttle_request;
        PBD::ScopedConnection parameter_connection;
        Gtk::Menu*        shuttle_unit_menu;
        Gtk::Menu*        shuttle_style_menu;
        Gtk::Menu*        shuttle_context_menu;
+       BindingProxy      binding_proxy;
 
        void build_shuttle_context_menu ();
        void show_shuttle_context_menu ();
@@ -79,6 +81,7 @@ class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr
        bool on_motion_notify_event(GdkEventMotion*);
        bool on_expose_event(GdkEventExpose*);
        void on_size_allocate (Gtk::Allocation&);
+       bool on_query_tooltip (int, int, bool, const Glib::RefPtr<Gtk::Tooltip>&);
 
        gint mouse_shuttle (double x, bool force);
        void use_shuttle_fract (bool force);
@@ -86,6 +89,12 @@ class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr
 
        void set_shuttle_units (ARDOUR::ShuttleUnits);
        void set_shuttle_style (ARDOUR::ShuttleBehaviour);
+
+       int speed_as_semitones (float, bool&);
+       int fract_as_semitones (float, bool&);
+
+       float semitones_as_speed (int, bool);
+       float semitones_as_fract (int, bool);
 };
 
 #endif /* __gtk2_ardour_shuttle_control_h__ */