From a3af5e31f1870f45a2f4fd6315018610f36e5947 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Apr 2020 02:38:18 +0200 Subject: Update labels in MIDI Automation Lanes when MIDNAM changes --- gtk2_ardour/automation_time_axis.cc | 16 ++++++++++++++++ gtk2_ardour/automation_time_axis.h | 3 ++- gtk2_ardour/midi_time_axis.cc | 19 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 79f6a5cae6..ac524ab5e6 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -574,6 +574,22 @@ AutomationTimeAxisView::set_height (uint32_t h, TrackHeightMode m) } } +void +AutomationTimeAxisView::update_name_from_param () +{ + /* Note that this is intended for MidiTrack::describe_parameter() + * -> instrument_info().get_controller_name() + * It does not work with parent/plug_name for plugins. + */ + boost::shared_ptr r = boost::dynamic_pointer_cast (_stripable); + if (!r) { + return; + } + _name = r->describe_parameter(_parameter); + set_tooltip (controls_ebox, _name); + name_label.set_text (_name); +} + void AutomationTimeAxisView::set_samples_per_pixel (double fpp) { diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index e6643466b9..e345985e93 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -73,7 +73,7 @@ public: TimeAxisView& parent, bool show_regions, ArdourCanvas::Canvas& canvas, - const std::string & name, /* translatable */ + const std::string & name = "", /* translatable */ const std::string & plug_name = ""); ~AutomationTimeAxisView(); @@ -82,6 +82,7 @@ public: void set_samples_per_pixel (double); std::string name() const { return _name; } Gdk::Color color () const; + void update_name_from_param (); boost::shared_ptr stripable() const; ARDOUR::PresentationInfo const & presentation_info () const; diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index ceb6c83d16..dbf4829d03 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -351,6 +351,22 @@ MidiTimeAxisView::use_midnam_info () controller_menu = 0; setup_midnam_patches (); + + /* update names on any automation lane with MIDNAM names */ + for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) { + switch (i->first.type()) { + case MidiCCAutomation: + case MidiPgmChangeAutomation: + case MidiPitchBenderAutomation: + case MidiChannelPressureAutomation: + case MidiNotePressureAutomation: + case MidiSystemExclusiveAutomation: + i->second->update_name_from_param (); + break; + default: + continue; + } + } } void @@ -1316,6 +1332,9 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool *this, true, parent_canvas, + /* this calls MidiTrack::describe_parameter() + * -> instrument_info().get_controller_name() + */ _route->describe_parameter(param))); if (_view) { -- cgit v1.2.3