Touch Support for Ardour Fader
This commit is contained in:
parent
24b916d125
commit
000a1aaa46
@ -61,6 +61,8 @@ ArdourFader::ArdourFader (Gtk::Adjustment& adj, int orientation, int fader_lengt
|
||||
{
|
||||
update_unity_position ();
|
||||
|
||||
add_events (Gdk::TOUCH_UPDATE_MASK);
|
||||
|
||||
if (_orien == VERT) {
|
||||
CairoWidget::set_size_request(_girth, _span);
|
||||
} else {
|
||||
@ -464,6 +466,18 @@ ArdourFader::on_motion_notify_event (GdkEventMotion* ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ArdourFader::on_touch_update_event (GdkEventTouch* ev)
|
||||
{
|
||||
GdkEventMotion mev;
|
||||
mev.window = ev->window;
|
||||
mev.time = ev->time;
|
||||
mev.x = ev->x;
|
||||
mev.y = ev->y;
|
||||
mev.state = 0;
|
||||
return ArdourFader::on_motion_notify_event (&mev);
|
||||
}
|
||||
|
||||
/** @return pixel offset of the current value from the right or bottom of the fader */
|
||||
int
|
||||
ArdourFader::display_span ()
|
||||
|
@ -41,6 +41,8 @@ FaderWidget::FaderWidget (Gtk::Adjustment& adj, int orien)
|
||||
| Gdk::SCROLL_MASK
|
||||
| Gdk::ENTER_NOTIFY_MASK
|
||||
| Gdk::LEAVE_NOTIFY_MASK
|
||||
| Gdk::TOUCH_BEGIN_MASK
|
||||
| Gdk::TOUCH_END_MASK
|
||||
);
|
||||
|
||||
_adjustment.signal_value_changed().connect (mem_fun (*this, &FaderWidget::adjustment_changed));
|
||||
@ -100,6 +102,29 @@ FaderWidget::on_button_press_event (GdkEventButton* ev)
|
||||
return (_tweaks & NoButtonForward) ? true : false;
|
||||
}
|
||||
|
||||
bool
|
||||
FaderWidget::on_touch_begin_event (GdkEventTouch *ev)
|
||||
{
|
||||
StartGesture (0);
|
||||
_grab_loc = (_orien == VERT) ? ev->y : ev->x;
|
||||
_grab_start = (_orien == VERT) ? ev->y : ev->x;
|
||||
_grab_window = ev->window;
|
||||
_dragging = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
FaderWidget::on_touch_end_event (GdkEventTouch *ev)
|
||||
{
|
||||
if (!_dragging) {
|
||||
return true;
|
||||
}
|
||||
_dragging = false;
|
||||
StopGesture (0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
FaderWidget::on_enter_notify_event (GdkEventCrossing*)
|
||||
{
|
||||
|
@ -55,6 +55,7 @@ protected:
|
||||
|
||||
void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
|
||||
bool on_motion_notify_event (GdkEventMotion*);
|
||||
bool on_touch_update_event (GdkEventTouch*);
|
||||
|
||||
void on_state_changed (Gtk::StateType);
|
||||
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
|
||||
|
@ -62,6 +62,8 @@ public:
|
||||
protected:
|
||||
bool on_button_press_event (GdkEventButton*);
|
||||
bool on_button_release_event (GdkEventButton*);
|
||||
bool on_touch_begin_event (GdkEventTouch*);
|
||||
bool on_touch_end_event (GdkEventTouch*);
|
||||
bool on_enter_notify_event (GdkEventCrossing* ev);
|
||||
bool on_leave_notify_event (GdkEventCrossing* ev);
|
||||
bool on_scroll_event (GdkEventScroll* ev);
|
||||
|
Loading…
Reference in New Issue
Block a user