2011-04-19 22:48:20 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2011-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2011-04-19 22:48:20 -04:00
|
|
|
|
|
|
|
#ifndef __gtk2_ardour_shuttle_control_h__
|
|
|
|
#define __gtk2_ardour_shuttle_control_h__
|
|
|
|
|
|
|
|
#include <gtkmm/drawingarea.h>
|
|
|
|
|
|
|
|
#include "pbd/controllable.h"
|
2016-12-19 16:08:20 -05:00
|
|
|
|
2011-04-19 22:48:20 -04:00
|
|
|
#include "ardour/session_handle.h"
|
2016-12-19 16:08:20 -05:00
|
|
|
#include "ardour/types.h"
|
|
|
|
|
2017-07-16 22:55:52 -04:00
|
|
|
#include "gtkmm2ext/cairo_widget.h"
|
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "widgets/ardour_button.h"
|
2017-07-16 22:55:52 -04:00
|
|
|
#include "widgets/binding_proxy.h"
|
2011-04-19 22:48:20 -04:00
|
|
|
|
2021-07-18 18:48:53 -04:00
|
|
|
#include "varispeed_dialog.h"
|
2021-06-27 17:25:33 -04:00
|
|
|
|
2011-04-19 22:48:20 -04:00
|
|
|
namespace Gtk {
|
|
|
|
class Menu;
|
|
|
|
}
|
|
|
|
|
2021-06-18 16:26:22 -04:00
|
|
|
class ShuttleInfoButton : public ArdourWidgets::ArdourButton, public ARDOUR::SessionHandlePtr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ShuttleInfoButton ();
|
|
|
|
~ShuttleInfoButton ();
|
|
|
|
|
|
|
|
bool on_button_press_event (GdkEventButton*);
|
|
|
|
|
|
|
|
void set_shuttle_units (ARDOUR::ShuttleUnits s);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void parameter_changed (std::string);
|
|
|
|
void build_disp_context_menu ();
|
|
|
|
Gtk::Menu* disp_context_menu;
|
|
|
|
PBD::ScopedConnection parameter_connection;
|
|
|
|
|
|
|
|
bool _ignore_change;
|
|
|
|
};
|
|
|
|
|
2012-12-06 14:09:16 -05:00
|
|
|
class ShuttleControl : public CairoWidget, public ARDOUR::SessionHandlePtr
|
2011-04-19 22:48:20 -04:00
|
|
|
{
|
2016-12-19 16:08:20 -05:00
|
|
|
public:
|
2011-04-19 22:48:20 -04:00
|
|
|
ShuttleControl ();
|
|
|
|
~ShuttleControl ();
|
|
|
|
|
|
|
|
void map_transport_state ();
|
2015-03-10 05:52:44 -04:00
|
|
|
void set_shuttle_fract (double, bool zero_ok = false);
|
2011-04-19 22:48:20 -04:00
|
|
|
double get_shuttle_fract () const { return shuttle_fract; }
|
|
|
|
void set_session (ARDOUR::Session*);
|
|
|
|
|
2021-06-18 16:26:22 -04:00
|
|
|
void do_blink (bool);
|
|
|
|
|
2011-04-19 22:48:20 -04:00
|
|
|
struct ShuttleControllable : public PBD::Controllable {
|
|
|
|
ShuttleControllable (ShuttleControl&);
|
2016-01-02 04:58:23 -05:00
|
|
|
void set_value (double, PBD::Controllable::GroupControlDisposition group_override);
|
2011-04-19 22:48:20 -04:00
|
|
|
double get_value (void) const;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2016-12-19 16:08:20 -05:00
|
|
|
double lower() const { return -1.0; }
|
|
|
|
double upper() const { return 1.0; }
|
2013-01-17 09:48:17 -05:00
|
|
|
|
2011-04-19 22:48:20 -04:00
|
|
|
ShuttleControl& sc;
|
|
|
|
};
|
|
|
|
|
2011-04-20 01:07:41 -04:00
|
|
|
boost::shared_ptr<ShuttleControllable> controllable() const { return _controllable; }
|
2016-06-13 17:25:31 -04:00
|
|
|
void set_colors ();
|
2011-04-19 22:48:20 -04:00
|
|
|
|
2017-07-15 11:38:28 -04:00
|
|
|
ArdourWidgets::ArdourButton* info_button () { return &_info_button; }
|
2021-06-27 17:25:33 -04:00
|
|
|
ArdourWidgets::ArdourButton* vari_button () { return &_vari_button; }
|
2016-12-19 16:08:20 -05:00
|
|
|
|
2021-06-18 16:26:22 -04:00
|
|
|
public:
|
|
|
|
static int speed_as_semitones (float, bool&);
|
|
|
|
static int fract_as_semitones (float, bool&);
|
|
|
|
|
|
|
|
static float semitones_as_speed (int, bool);
|
|
|
|
static float semitones_as_fract (int, bool);
|
|
|
|
|
|
|
|
static int speed_as_cents (float, bool&);
|
|
|
|
static float cents_as_speed (int, bool);
|
|
|
|
|
|
|
|
|
2016-12-19 16:08:20 -05:00
|
|
|
protected:
|
2012-12-06 14:09:16 -05:00
|
|
|
bool _hovering;
|
2011-04-19 22:48:20 -04:00
|
|
|
float shuttle_max_speed;
|
|
|
|
float last_speed_displayed;
|
|
|
|
bool shuttle_grabbed;
|
2011-05-13 13:25:02 -04:00
|
|
|
double shuttle_speed_on_grab;
|
2016-07-25 13:43:57 -04:00
|
|
|
double requested_speed;
|
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;
|
2012-12-06 14:09:16 -05:00
|
|
|
cairo_pattern_t* shine_pattern;
|
2021-06-27 11:32:30 -04:00
|
|
|
PBD::microseconds_t last_shuttle_request;
|
2011-04-19 22:48:20 -04:00
|
|
|
PBD::ScopedConnection parameter_connection;
|
2021-06-18 16:26:22 -04:00
|
|
|
ShuttleInfoButton _info_button;
|
2017-07-16 22:55:52 -04:00
|
|
|
Gtk::Menu* shuttle_context_menu;
|
|
|
|
ArdourWidgets::BindingProxy binding_proxy;
|
2016-06-13 17:25:31 -04:00
|
|
|
float bg_r, bg_g, bg_b;
|
2011-04-19 22:48:20 -04:00
|
|
|
void build_shuttle_context_menu ();
|
|
|
|
void set_shuttle_max_speed (float);
|
|
|
|
|
2021-06-27 17:25:33 -04:00
|
|
|
VarispeedDialog _vari_dialog;
|
|
|
|
ArdourWidgets::ArdourButton _vari_button;
|
|
|
|
void varispeed_button_clicked ();
|
|
|
|
|
2012-12-06 14:09:16 -05:00
|
|
|
bool on_enter_notify_event (GdkEventCrossing*);
|
|
|
|
bool on_leave_notify_event (GdkEventCrossing*);
|
2011-04-19 22:48:20 -04:00
|
|
|
bool on_button_press_event (GdkEventButton*);
|
|
|
|
bool on_button_release_event(GdkEventButton*);
|
|
|
|
bool on_motion_notify_event(GdkEventMotion*);
|
2012-12-06 14:09:16 -05:00
|
|
|
|
2021-06-18 16:26:22 -04:00
|
|
|
bool on_button_press_event_for_display (GdkEventButton*);
|
|
|
|
|
2017-03-20 12:11:56 -04:00
|
|
|
void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
|
2012-12-06 14:09:16 -05:00
|
|
|
|
2011-04-19 22:48:20 -04:00
|
|
|
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
|
|
|
|
2016-12-19 16:08:20 -05:00
|
|
|
gint mouse_shuttle (double x, bool force);
|
|
|
|
void use_shuttle_fract (bool force, bool zero_ok = false);
|
2011-04-19 22:48:20 -04:00
|
|
|
void parameter_changed (std::string);
|
|
|
|
|
|
|
|
void set_shuttle_units (ARDOUR::ShuttleUnits);
|
2021-06-26 12:58:24 -04:00
|
|
|
|
2021-04-20 08:26:30 -04:00
|
|
|
bool _ignore_change;
|
2011-04-19 22:48:20 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk2_ardour_shuttle_control_h__ */
|