2011-04-19 22:48:20 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2011 Paul Davis
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __gtk2_ardour_shuttle_control_h__
|
|
|
|
#define __gtk2_ardour_shuttle_control_h__
|
|
|
|
|
|
|
|
#include <gtkmm/drawingarea.h>
|
|
|
|
|
2011-04-20 01:07:41 -04:00
|
|
|
#include "gtkmm2ext/binding_proxy.h"
|
|
|
|
|
2011-04-19 22:48:20 -04:00
|
|
|
#include "pbd/controllable.h"
|
|
|
|
#include "ardour/session_handle.h"
|
|
|
|
|
|
|
|
namespace Gtk {
|
|
|
|
class Menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "ardour/types.h"
|
|
|
|
|
|
|
|
class ShuttleControl : public Gtk::DrawingArea, public ARDOUR::SessionHandlePtr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ShuttleControl ();
|
|
|
|
~ShuttleControl ();
|
|
|
|
|
|
|
|
void map_transport_state ();
|
|
|
|
void update_speed_display ();
|
|
|
|
void set_shuttle_fract (double);
|
|
|
|
double get_shuttle_fract () const { return shuttle_fract; }
|
|
|
|
void set_session (ARDOUR::Session*);
|
|
|
|
|
|
|
|
struct ShuttleControllable : public PBD::Controllable {
|
|
|
|
ShuttleControllable (ShuttleControl&);
|
|
|
|
void set_value (double);
|
|
|
|
double get_value (void) const;
|
|
|
|
|
|
|
|
void set_id (const std::string&);
|
|
|
|
|
|
|
|
ShuttleControl& sc;
|
|
|
|
};
|
|
|
|
|
2011-04-20 01:07:41 -04:00
|
|
|
boost::shared_ptr<ShuttleControllable> controllable() const { return _controllable; }
|
2011-04-19 22:48:20 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
float shuttle_max_speed;
|
|
|
|
float last_speed_displayed;
|
|
|
|
bool shuttle_grabbed;
|
2011-05-13 13:25:02 -04:00
|
|
|
double shuttle_speed_on_grab;
|
2011-04-21 17:49:47 -04:00
|
|
|
float shuttle_fract;
|
2011-04-20 01:07:41 -04:00
|
|
|
boost::shared_ptr<ShuttleControllable> _controllable;
|
2011-04-19 22:48:20 -04:00
|
|
|
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;
|
2011-04-20 01:07:41 -04:00
|
|
|
BindingProxy binding_proxy;
|
2011-04-19 22:48:20 -04:00
|
|
|
|
|
|
|
void build_shuttle_context_menu ();
|
|
|
|
void show_shuttle_context_menu ();
|
|
|
|
void shuttle_style_changed();
|
|
|
|
void shuttle_unit_clicked ();
|
|
|
|
void set_shuttle_max_speed (float);
|
|
|
|
|
|
|
|
bool on_button_press_event (GdkEventButton*);
|
|
|
|
bool on_button_release_event(GdkEventButton*);
|
|
|
|
bool on_scroll_event (GdkEventScroll*);
|
|
|
|
bool on_motion_notify_event(GdkEventMotion*);
|
|
|
|
bool on_expose_event(GdkEventExpose*);
|
|
|
|
void on_size_allocate (Gtk::Allocation&);
|
2011-04-20 18:53:41 -04:00
|
|
|
bool on_query_tooltip (int, int, bool, const Glib::RefPtr<Gtk::Tooltip>&);
|
2011-04-19 22:48:20 -04:00
|
|
|
|
|
|
|
gint mouse_shuttle (double x, bool force);
|
|
|
|
void use_shuttle_fract (bool force);
|
|
|
|
void parameter_changed (std::string);
|
|
|
|
|
|
|
|
void set_shuttle_units (ARDOUR::ShuttleUnits);
|
|
|
|
void set_shuttle_style (ARDOUR::ShuttleBehaviour);
|
2011-04-21 17:49:47 -04:00
|
|
|
|
2011-04-22 12:18:51 -04:00
|
|
|
int speed_as_semitones (float, bool&);
|
|
|
|
int fract_as_semitones (float, bool&);
|
|
|
|
|
|
|
|
float semitones_as_speed (int, bool);
|
|
|
|
float semitones_as_fract (int, bool);
|
2011-04-19 22:48:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk2_ardour_shuttle_control_h__ */
|