somewhat illogical and temporary workaround to the problems with consolidate & bounce...
[ardour2.git] / gtk2_ardour / shuttle_control.h
blob836ac535ed95488cf6e2011446e6d99f519ccab2
1 /*
2 Copyright (C) 2011 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.
19 #ifndef __gtk2_ardour_shuttle_control_h__
20 #define __gtk2_ardour_shuttle_control_h__
22 #include <gtkmm/drawingarea.h>
24 #include "gtkmm2ext/binding_proxy.h"
26 #include "pbd/controllable.h"
27 #include "ardour/session_handle.h"
29 namespace Gtk {
30 class Menu;
33 #include "ardour/types.h"
35 class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr
37 public:
38 ShuttleControl ();
39 ~ShuttleControl ();
41 void map_transport_state ();
42 void update_speed_display ();
43 void set_shuttle_fract (double);
44 double get_shuttle_fract () const { return shuttle_fract; }
45 void set_session (ARDOUR::Session*);
47 struct ShuttleControllable : public PBD::Controllable {
48 ShuttleControllable (ShuttleControl&);
49 void set_value (double);
50 double get_value (void) const;
52 void set_id (const std::string&);
54 ShuttleControl& sc;
57 boost::shared_ptr<ShuttleControllable> controllable() const { return _controllable; }
59 protected:
60 float shuttle_max_speed;
61 float last_speed_displayed;
62 bool shuttle_grabbed;
63 double shuttle_speed_on_grab;
64 float shuttle_fract;
65 boost::shared_ptr<ShuttleControllable> _controllable;
66 cairo_pattern_t* pattern;
67 ARDOUR::microseconds_t last_shuttle_request;
68 PBD::ScopedConnection parameter_connection;
69 Gtk::Menu* shuttle_unit_menu;
70 Gtk::Menu* shuttle_style_menu;
71 Gtk::Menu* shuttle_context_menu;
72 BindingProxy binding_proxy;
74 void build_shuttle_context_menu ();
75 void show_shuttle_context_menu ();
76 void shuttle_style_changed();
77 void shuttle_unit_clicked ();
78 void set_shuttle_max_speed (float);
80 bool on_button_press_event (GdkEventButton*);
81 bool on_button_release_event(GdkEventButton*);
82 bool on_scroll_event (GdkEventScroll*);
83 bool on_motion_notify_event(GdkEventMotion*);
84 bool on_expose_event(GdkEventExpose*);
85 void on_size_allocate (Gtk::Allocation&);
86 bool on_query_tooltip (int, int, bool, const Glib::RefPtr<Gtk::Tooltip>&);
88 gint mouse_shuttle (double x, bool force);
89 void use_shuttle_fract (bool force);
90 void parameter_changed (std::string);
92 void set_shuttle_units (ARDOUR::ShuttleUnits);
93 void set_shuttle_style (ARDOUR::ShuttleBehaviour);
95 int speed_as_semitones (float, bool&);
96 int fract_as_semitones (float, bool&);
98 float semitones_as_speed (int, bool);
99 float semitones_as_fract (int, bool);
102 #endif /* __gtk2_ardour_shuttle_control_h__ */