ardour
shuttle_control.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 Paul Davis
3 
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.
8 
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.
13 
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.
17 */
18 
19 #ifndef __gtk2_ardour_shuttle_control_h__
20 #define __gtk2_ardour_shuttle_control_h__
21 
22 #include <gtkmm/drawingarea.h>
23 
25 
26 #include "pbd/controllable.h"
27 #include "ardour/session_handle.h"
28 
29 namespace Gtk {
30  class Menu;
31 }
32 
33 #include "ardour/types.h"
34 
36 {
37  public:
38  ShuttleControl ();
39  ~ShuttleControl ();
40 
41  void map_transport_state ();
42  void set_shuttle_fract (double, bool zero_ok = false);
43  double get_shuttle_fract () const { return shuttle_fract; }
45 
48  void set_value (double);
49  double get_value (void) const;
50 
51  double lower() const { return -1.0; }
52  double upper() const { return 1.0; }
53 
55  };
56 
58 
59  protected:
60  bool _hovering;
67  cairo_pattern_t* pattern;
68  cairo_pattern_t* shine_pattern;
71  Gtk::Menu* shuttle_unit_menu;
72  Gtk::Menu* shuttle_style_menu;
75 
78  void shuttle_style_changed();
79  void shuttle_unit_clicked ();
80  void set_shuttle_max_speed (float);
81 
82  bool on_enter_notify_event (GdkEventCrossing*);
83  bool on_leave_notify_event (GdkEventCrossing*);
84  bool on_button_press_event (GdkEventButton*);
85  bool on_button_release_event(GdkEventButton*);
86  bool on_scroll_event (GdkEventScroll*);
87  bool on_motion_notify_event(GdkEventMotion*);
88 
89  void render (cairo_t *, cairo_rectangle_t*);
90 
91  void on_size_allocate (Gtk::Allocation&);
92  bool on_query_tooltip (int, int, bool, const Glib::RefPtr<Gtk::Tooltip>&);
93 
94  gint mouse_shuttle (double x, bool force);
95  void use_shuttle_fract (bool force, bool zero_ok = false);
96  void parameter_changed (std::string);
97 
100 
101  int speed_as_semitones (float, bool&);
102  int fract_as_semitones (float, bool&);
103 
104  float semitones_as_speed (int, bool);
105  float semitones_as_fract (int, bool);
106 };
107 
108 #endif /* __gtk2_ardour_shuttle_control_h__ */
void use_shuttle_fract(bool force, bool zero_ok=false)
float last_speed_displayed
void on_size_allocate(Gtk::Allocation &)
int fract_as_semitones(float, bool &)
BindingProxy binding_proxy
gint mouse_shuttle(double x, bool force)
void set_shuttle_units(ARDOUR::ShuttleUnits)
Definition: ardour_ui.h:130
Gtk::Menu * shuttle_unit_menu
bool on_button_release_event(GdkEventButton *)
bool on_scroll_event(GdkEventScroll *)
cairo_pattern_t * pattern
int speed_as_semitones(float, bool &)
bool on_query_tooltip(int, int, bool, const Glib::RefPtr< Gtk::Tooltip > &)
void set_shuttle_max_speed(float)
PBD::ScopedConnection parameter_connection
void show_shuttle_context_menu()
Gtk::Menu * shuttle_style_menu
void shuttle_style_changed()
void set_shuttle_fract(double, bool zero_ok=false)
bool on_button_press_event(GdkEventButton *)
void shuttle_unit_clicked()
Gtk::Menu * shuttle_context_menu
void map_transport_state()
ShuttleUnits
Definition: types.h:515
double get_shuttle_fract() const
void parameter_changed(std::string)
cairo_pattern_t * shine_pattern
void set_session(ARDOUR::Session *)
void render(cairo_t *, cairo_rectangle_t *)
boost::shared_ptr< ShuttleControllable > _controllable
bool on_leave_notify_event(GdkEventCrossing *)
ARDOUR::microseconds_t last_shuttle_request
boost::shared_ptr< ShuttleControllable > controllable() const
float semitones_as_fract(int, bool)
bool on_motion_notify_event(GdkEventMotion *)
float semitones_as_speed(int, bool)
bool on_enter_notify_event(GdkEventCrossing *)
uint64_t microseconds_t
Definition: types.h:60
void set_shuttle_style(ARDOUR::ShuttleBehaviour)
void build_shuttle_context_menu()
ShuttleBehaviour
Definition: types.h:510
double shuttle_speed_on_grab