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:
|
2021-07-18 20:31:23 -04:00
|
|
|
void parameter_changed (std::string);
|
|
|
|
void build_disp_context_menu ();
|
2021-06-18 16:26:22 -04:00
|
|
|
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 ();
|
|
|
|
|
2021-07-18 20:31:23 -04:00
|
|
|
void map_transport_state ();
|
|
|
|
void set_shuttle_fract (double, bool zero_ok = false);
|
|
|
|
double get_shuttle_fract () const
|
|
|
|
{
|
|
|
|
return shuttle_fract;
|
|
|
|
}
|
2011-04-19 22:48:20 -04:00
|
|
|
void set_session (ARDOUR::Session*);
|
|
|
|
|
2021-06-18 16:26:22 -04:00
|
|
|
void do_blink (bool);
|
2021-07-18 20:31:23 -04:00
|
|
|
void set_colors ();
|
2021-06-18 16:26:22 -04:00
|
|
|
|
2011-04-19 22:48:20 -04:00
|
|
|
struct ShuttleControllable : public PBD::Controllable {
|
|
|
|
ShuttleControllable (ShuttleControl&);
|
2021-07-18 20:31:23 -04: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
|
|
|
|
2021-07-18 20:31:23 -04: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;
|
|
|
|
};
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ShuttleControllable> controllable () const
|
2021-07-18 20:31:23 -04:00
|
|
|
{
|
|
|
|
return _controllable;
|
|
|
|
}
|
2011-04-19 22:48:20 -04:00
|
|
|
|
2021-07-18 20:31:23 -04:00
|
|
|
ArdourWidgets::ArdourButton* info_button ()
|
|
|
|
{
|
|
|
|
return &_info_button;
|
|
|
|
}
|
|
|
|
|
|
|
|
ArdourWidgets::ArdourButton* vari_button ()
|
|
|
|
{
|
|
|
|
return &_vari_button;
|
|
|
|
}
|
2016-12-19 16:08:20 -05:00
|
|
|
|
2021-06-18 16:26:22 -04:00
|
|
|
public:
|
2022-05-24 14:06:41 -04:00
|
|
|
float speed_as_fract (float) const;
|
|
|
|
float fract_as_speed (float) const;
|
|
|
|
|
2022-06-05 17:23:18 -04:00
|
|
|
static int speed_as_semitones (float, bool&);
|
|
|
|
static int speed_as_cents (float, bool&);
|
2021-06-18 16:26:22 -04:00
|
|
|
|
2016-12-19 16:08:20 -05:00
|
|
|
protected:
|
2021-07-18 20:31:23 -04:00
|
|
|
bool _hovering;
|
|
|
|
float shuttle_max_speed;
|
|
|
|
float last_speed_displayed;
|
2023-10-09 22:18:53 -04:00
|
|
|
float last_shuttle_fract;
|
2021-07-18 20:31:23 -04:00
|
|
|
bool shuttle_grabbed;
|
|
|
|
double shuttle_speed_on_grab;
|
|
|
|
double requested_speed;
|
|
|
|
float shuttle_fract;
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ShuttleControllable> _controllable;
|
2021-07-18 20:31:23 -04:00
|
|
|
cairo_pattern_t* pattern;
|
|
|
|
cairo_pattern_t* shine_pattern;
|
|
|
|
PBD::microseconds_t last_shuttle_request;
|
|
|
|
PBD::ScopedConnection parameter_connection;
|
2023-02-03 21:21:27 -05:00
|
|
|
PBD::ScopedConnection port_connection;
|
2021-07-18 20:31:23 -04:00
|
|
|
ShuttleInfoButton _info_button;
|
|
|
|
Gtk::Menu* shuttle_context_menu;
|
|
|
|
ArdourWidgets::BindingProxy binding_proxy;
|
|
|
|
float bg_r, bg_g, bg_b;
|
|
|
|
void build_shuttle_context_menu ();
|
|
|
|
void set_shuttle_max_speed (float);
|
|
|
|
|
|
|
|
VarispeedDialog _vari_dialog;
|
2021-06-27 17:25:33 -04:00
|
|
|
ArdourWidgets::ArdourButton _vari_button;
|
2021-07-18 20:31:23 -04:00
|
|
|
void varispeed_button_clicked ();
|
|
|
|
bool varispeed_button_scroll_event (GdkEventScroll*);
|
2021-06-27 17:25:33 -04:00
|
|
|
|
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*);
|
2021-07-18 20:31:23 -04:00
|
|
|
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__ */
|