Allow to hide inline-controls using shift+right click

This commit is contained in:
Robin Gareus 2020-04-18 01:04:45 +02:00
parent 929754f48c
commit 5c5f0c8282
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 25 additions and 4 deletions

View file

@ -246,7 +246,7 @@ ProcessorEntry::ProcessorEntry (ProcessorBox* parent, boost::shared_ptr<Processo
label = _("Return"); label = _("Return");
} }
Control* c = new Control (_processor->automation_control (*i), label); Control* c = new Control (*this, _processor->automation_control (*i), label);
_controls.push_back (c); _controls.push_back (c);
@ -834,8 +834,9 @@ ProcessorEntry::toggle_allow_feedback ()
} }
} }
ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string const & n) ProcessorEntry::Control::Control (ProcessorEntry& e,boost::shared_ptr<AutomationControl> c, string const & n)
: _control (c) : _entry (e)
, _control (c)
, _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1) , _adjustment (gain_to_slider_position_with_max (1.0, Config->get_max_gain()), 0, 1, 0.01, 0.1)
, _slider (&_adjustment, boost::shared_ptr<PBD::Controllable>(), 0, max(13.f, rintf(13.f * UIConfiguration::instance().get_ui_scale()))) , _slider (&_adjustment, boost::shared_ptr<PBD::Controllable>(), 0, max(13.f, rintf(13.f * UIConfiguration::instance().get_ui_scale())))
, _slider_persistant_tooltip (&_slider) , _slider_persistant_tooltip (&_slider)
@ -862,6 +863,9 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
control_automation_state_changed (); control_automation_state_changed ();
} }
_button.set_fallthrough_to_parent (true);
_button.signal_button_release_event().connect (sigc::mem_fun(*this, &Control::button_released));
} else { } else {
_slider.set_name ("ProcessorControlSlider"); _slider.set_name ("ProcessorControlSlider");
@ -886,6 +890,8 @@ ProcessorEntry::Control::Control (boost::shared_ptr<AutomationControl> c, string
_slider.StartGesture.connect(sigc::mem_fun(*this, &Control::start_touch)); _slider.StartGesture.connect(sigc::mem_fun(*this, &Control::start_touch));
_slider.StopGesture.connect(sigc::mem_fun(*this, &Control::end_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)); _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 ()); c->Changed.connect (_connections, invalidator (*this), boost::bind (&Control::control_changed, this), gui_context ());
if (c->alist ()) { if (c->alist ()) {
@ -956,6 +962,16 @@ ProcessorEntry::Control::end_touch ()
c->stop_touch (c->session().transport_sample()); 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 void
ProcessorEntry::Control::button_clicked () ProcessorEntry::Control::button_clicked ()
{ {

View file

@ -200,7 +200,7 @@ private:
class Control : public sigc::trackable { class Control : public sigc::trackable {
public: public:
Control (boost::shared_ptr<ARDOUR::AutomationControl>, std::string const &); Control (ProcessorEntry&, boost::shared_ptr<ARDOUR::AutomationControl>, std::string const &);
~Control (); ~Control ();
void set_visible (bool); void set_visible (bool);
@ -230,6 +230,9 @@ private:
void start_touch (); void start_touch ();
void end_touch (); void end_touch ();
bool button_released (GdkEventButton*);
ProcessorEntry& _entry;
boost::weak_ptr<ARDOUR::AutomationControl> _control; boost::weak_ptr<ARDOUR::AutomationControl> _control;
/* things for a slider */ /* things for a slider */
Gtk::Adjustment _adjustment; Gtk::Adjustment _adjustment;
@ -245,7 +248,9 @@ private:
std::list<Control*> _controls; std::list<Control*> _controls;
friend class Control;
void toggle_control_visibility (Control *); void toggle_control_visibility (Control *);
void toggle_panner_link (); void toggle_panner_link ();
void toggle_allow_feedback (); void toggle_allow_feedback ();