widgets & GUI: Start/StopGesture signals should pass on GDK event state

This commit is contained in:
Paul Davis 2023-07-26 13:11:52 -06:00
parent 7ddd2a0692
commit 3c2112abf5
17 changed files with 42 additions and 43 deletions

View File

@ -212,14 +212,14 @@ AutomationController::value_adjusted ()
}
void
AutomationController::start_touch()
AutomationController::start_touch (int state)
{
_grabbed = true;
_controllable->start_touch (timepos_t (_controllable->session().transport_sample()));
}
void
AutomationController::end_touch ()
AutomationController::end_touch (int state)
{
_controllable->stop_touch (timepos_t (_controllable->session().transport_sample()));
if (_grabbed) {
@ -229,20 +229,20 @@ AutomationController::end_touch ()
}
bool
AutomationController::button_press (GdkEventButton*)
AutomationController::button_press (GdkEventButton* ev)
{
ArdourButton* but = dynamic_cast<ArdourButton*>(_widget);
if (but) {
start_touch ();
start_touch (ev->state);
_controllable->set_value (but->get_active () ? 0.0 : 1.0, Controllable::UseGroup);
}
return false;
}
bool
AutomationController::button_release (GdkEventButton*)
AutomationController::button_release (GdkEventButton* ev)
{
end_touch ();
end_touch (ev->state);
return true;
}

View File

@ -88,8 +88,8 @@ private:
Gtk::Adjustment* adj,
bool use_knob);
void start_touch();
void end_touch();
void start_touch(int);
void end_touch(int);
bool button_press(GdkEventButton*);
bool button_release(GdkEventButton*);

View File

@ -752,13 +752,13 @@ GainMeterBase::meter_point_clicked (MeterPoint mp)
}
void
GainMeterBase::amp_start_touch ()
GainMeterBase::amp_start_touch (int state)
{
_control->start_touch (timepos_t (_control->session().transport_sample()));
}
void
GainMeterBase::amp_stop_touch ()
GainMeterBase::amp_stop_touch (int state)
{
_control->stop_touch (timepos_t (_control->session().transport_sample()));
effective_gain_display ();

View File

@ -186,8 +186,8 @@ protected:
Gtk::Menu* meter_menu;
void popup_meter_menu (GdkEventButton*);
void amp_stop_touch ();
void amp_start_touch ();
void amp_stop_touch (int);
void amp_start_touch (int);
void set_route_group_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
void set_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);

View File

@ -1010,13 +1010,13 @@ MeterStrip::color () const
}
void
MeterStrip::gain_start_touch ()
MeterStrip::gain_start_touch (int)
{
_route->gain_control ()->start_touch (timepos_t (_session->transport_sample ()));
}
void
MeterStrip::gain_end_touch ()
MeterStrip::gain_end_touch (int)
{
_route->gain_control ()->stop_touch (timepos_t (_session->transport_sample ()));
}

View File

@ -151,8 +151,8 @@ private:
bool peak_button_release (GdkEventButton*);
void gain_start_touch ();
void gain_end_touch ();
void gain_start_touch (int);
void gain_end_touch (int);
void parameter_changed (std::string const & p);
void redraw_metrics ();

View File

@ -500,7 +500,7 @@ MixerStrip::update_trim_control ()
}
void
MixerStrip::trim_start_touch ()
MixerStrip::trim_start_touch (int)
{
assert (_route && _session);
if (route()->trim() && route()->trim()->active() && route()->n_inputs().n_audio() > 0) {
@ -509,7 +509,7 @@ MixerStrip::trim_start_touch ()
}
void
MixerStrip::trim_end_touch ()
MixerStrip::trim_end_touch (int)
{
assert (_route && _session);
if (route()->trim() && route()->trim()->active() && route()->n_inputs().n_audio() > 0) {

View File

@ -240,8 +240,8 @@ private:
ArdourWidgets::ArdourButton* _loudess_analysis_button;
std::shared_ptr<AutomationController> _volume_controller;
void trim_start_touch ();
void trim_end_touch ();
void trim_start_touch (int);
void trim_end_touch (int);
void setup_comment_button ();

View File

@ -1103,7 +1103,7 @@ ProcessorEntry::Control::slider_adjusted ()
}
void
ProcessorEntry::Control::start_touch ()
ProcessorEntry::Control::start_touch (int)
{
std::shared_ptr<AutomationControl> c = _control.lock ();
if (!c) {
@ -1113,7 +1113,7 @@ ProcessorEntry::Control::start_touch ()
}
void
ProcessorEntry::Control::end_touch ()
ProcessorEntry::Control::end_touch (int)
{
std::shared_ptr<AutomationControl> c = _control.lock ();
if (!c) {

View File

@ -234,8 +234,8 @@ private:
std::string state_id () const;
void set_tooltip ();
void start_touch ();
void end_touch ();
void start_touch (int);
void end_touch (int);
bool button_released (GdkEventButton*);

View File

@ -614,7 +614,7 @@ VirtualKeyboardWindow::pitch_bend_event_handler (int val)
}
void
VirtualKeyboardWindow::pitch_bend_release ()
VirtualKeyboardWindow::pitch_bend_release (int)
{
_pitch_adjustment.set_value (8192);
}

View File

@ -116,7 +116,7 @@ private:
bool pitch_bend_timeout ();
void pitch_bend_event_handler (int);
void pitch_bend_release ();
void pitch_bend_release (int);
void pitch_bend_update_tooltip (int);
void pitch_slider_adjusted ();

View File

@ -211,7 +211,7 @@ ArdourCtrlBase::on_button_press_event (GdkEventButton *ev)
if (_grabbed) {
remove_modal_grab();
_grabbed = false;
StopGesture ();
StopGesture (ev->state);
gdk_pointer_ungrab (GDK_CURRENT_TIME);
}
return true;
@ -229,7 +229,7 @@ ArdourCtrlBase::on_button_press_event (GdkEventButton *ev)
_tooltip.start_drag();
add_modal_grab();
_grabbed = true;
StartGesture ();
StartGesture (ev->state);
gdk_pointer_grab(ev->window,false,
GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
NULL,NULL,ev->time);
@ -241,7 +241,7 @@ ArdourCtrlBase::on_button_release_event (GdkEventButton *ev)
{
_tooltip.stop_drag();
_grabbed = false;
StopGesture ();
StopGesture (ev->state);
remove_modal_grab();
gdk_pointer_ungrab (GDK_CURRENT_TIME);

View File

@ -441,7 +441,7 @@ ArdourFader::on_grab_broken_event (GdkEventGrabBroken* ev)
remove_modal_grab();
_dragging = false;
gdk_pointer_ungrab (GDK_CURRENT_TIME);
StopGesture ();
StopGesture (0);
}
return (_tweaks & NoButtonForward) ? true : false;
}
@ -454,7 +454,7 @@ ArdourFader::on_button_press_event (GdkEventButton* ev)
remove_modal_grab();
_dragging = false;
gdk_pointer_ungrab (GDK_CURRENT_TIME);
StopGesture ();
StopGesture (ev->state);
}
return (_tweaks & NoButtonForward) ? true : false;
}
@ -464,7 +464,7 @@ ArdourFader::on_button_press_event (GdkEventButton* ev)
}
add_modal_grab ();
StartGesture ();
StartGesture (ev->state);
_grab_loc = (_orien == VERT) ? ev->y : ev->x;
_grab_start = (_orien == VERT) ? ev->y : ev->x;
_grab_window = ev->window;
@ -491,7 +491,7 @@ ArdourFader::on_button_release_event (GdkEventButton* ev)
remove_modal_grab();
_dragging = false;
gdk_pointer_ungrab (GDK_CURRENT_TIME);
StopGesture ();
StopGesture (ev->state);
if (!_hovering) {
if (!(_tweaks & NoVerticalScroll)) {
@ -527,7 +527,7 @@ ArdourFader::on_button_release_event (GdkEventButton* ev)
if (_dragging) {
remove_modal_grab();
_dragging = false;
StopGesture ();
StopGesture (ev->state);
set_adjustment_from_event (ev);
gdk_pointer_ungrab (GDK_CURRENT_TIME);
return true;

View File

@ -80,8 +80,8 @@ public:
void color_handler ();
sigc::signal<void> StartGesture;
sigc::signal<void> StopGesture;
sigc::signal<void,int> StartGesture;
sigc::signal<void,int> StopGesture;
void set_size_request (int, int);

View File

@ -39,8 +39,8 @@ public:
virtual ~ArdourFader ();
static void flush_pattern_cache();
sigc::signal<void> StartGesture;
sigc::signal<void> StopGesture;
sigc::signal<void,int> StartGesture;
sigc::signal<void,int> StopGesture;
sigc::signal<void> OnExpose;
void set_default_value (float);

View File

@ -42,8 +42,8 @@ public:
ArdourFader::Tweaks tweaks() const { return _slider.tweaks (); }
void set_tweaks (ArdourFader::Tweaks t) { _slider.set_tweaks (t);}
sigc::signal<void> StartGesture;
sigc::signal<void> StopGesture;
sigc::signal<void,int> StartGesture;
sigc::signal<void,int> StopGesture;
/* export this to allow direct connection to button events */
Gtk::Widget& event_widget() { return _slider; }
@ -74,9 +74,8 @@ private:
bool _switching;
bool _switch_on_release;
void passtrhu_gesture_start() { StartGesture (); }
void passtrhu_gesture_stop() { StopGesture (); }
void passtrhu_gesture_start (int state) { StartGesture (state); }
void passtrhu_gesture_stop (int state) { StopGesture (state); }
};