From 5c5f0c8282866aecd41de070c33edd8b22dc3d77 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 18 Apr 2020 01:04:45 +0200 Subject: Allow to hide inline-controls using shift+right click --- gtk2_ardour/processor_box.cc | 22 +++++++++++++++++++--- gtk2_ardour/processor_box.h | 7 ++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 28e3342df2..fcecfbe215 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -246,7 +246,7 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptrautomation_control (*i), label); + Control* c = new Control (*this, _processor->automation_control (*i), label); _controls.push_back (c); @@ -834,8 +834,9 @@ ProcessorEntry::toggle_allow_feedback () } } -ProcessorEntry::Control::Control (boost::shared_ptr c, string const & n) - : _control (c) +ProcessorEntry::Control::Control (ProcessorEntry& e,boost::shared_ptr c, string const & n) + : _entry (e) + , _control (c) , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) , _slider (&_adjustment, boost::shared_ptr(), 0, max(13.f, rintf(13.f * UIConfiguration::instance().get_ui_scale()))) , _slider_persistant_tooltip (&_slider) @@ -862,6 +863,9 @@ ProcessorEntry::Control::Control (boost::shared_ptr c, string control_automation_state_changed (); } + _button.set_fallthrough_to_parent (true); + _button.signal_button_release_event().connect (sigc::mem_fun(*this, &Control::button_released)); + } else { _slider.set_name ("ProcessorControlSlider"); @@ -886,6 +890,8 @@ ProcessorEntry::Control::Control (boost::shared_ptr c, string _slider.StartGesture.connect(sigc::mem_fun(*this, &Control::start_touch)); _slider.StopGesture.connect(sigc::mem_fun(*this, &Control::end_touch)); + _slider.signal_button_release_event().connect (sigc::mem_fun(*this, &Control::button_released)); + _adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &Control::slider_adjusted)); c->Changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_changed, this), gui_context ()); if (c->alist ()) { @@ -956,6 +962,16 @@ ProcessorEntry::Control::end_touch () c->stop_touch (c->session().transport_sample()); } +bool +ProcessorEntry::Control::button_released (GdkEventButton* ev) +{ + if (Keyboard::is_delete_event (ev)) { + _entry.toggle_control_visibility (this); + return true; + } + return false; +} + void ProcessorEntry::Control::button_clicked () { diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 4b49dbe67f..2063ab064b 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -200,7 +200,7 @@ private: class Control : public sigc::trackable { public: - Control (boost::shared_ptr, std::string const &); + Control (ProcessorEntry&, boost::shared_ptr, std::string const &); ~Control (); void set_visible (bool); @@ -230,6 +230,9 @@ private: void start_touch (); void end_touch (); + bool button_released (GdkEventButton*); + + ProcessorEntry& _entry; boost::weak_ptr _control; /* things for a slider */ Gtk::Adjustment _adjustment; @@ -245,7 +248,9 @@ private: std::list _controls; + friend class Control; void toggle_control_visibility (Control *); + void toggle_panner_link (); void toggle_allow_feedback (); -- cgit v1.2.3