From dd3683bc06b0e84c71a1384c5fc601392b875f64 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 16 Mar 2025 15:43:11 -0600 Subject: [PATCH] fix another #warning from the pianorule refactoring There is one single place in AutomationLine code where we need to callback to its AutomationTimeAxisView, if it is part of one, regarding automation state. This permits that to happen --- gtk2_ardour/automation_line.cc | 12 ++++++++++-- gtk2_ardour/automation_line.h | 4 ++++ gtk2_ardour/editor_automation_line.cc | 16 +++++++++++----- gtk2_ardour/editor_automation_line.h | 10 +++++----- gtk2_ardour/midi_automation_line.cc | 12 ++++++------ 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 2cf101bab2..4dd588dd50 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -112,6 +112,7 @@ AutomationLine::AutomationLine (const string& name, , _desc (desc) , _control_points_inherit_color (true) , _sensitive (true) + , atv (nullptr) { group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple(0, 1.5)); CANVAS_DEBUG_NAME (group, "automation line group"); @@ -1628,8 +1629,9 @@ AutomationLine::add (std::shared_ptr control, GdkEvent* event if (alist->editor_add (when, y, with_guard_points)) { if (control->automation_state () == ARDOUR::Off) { -#warning paul make this work again .. call back to ATV or similar - // set_automation_state (ARDOUR::Play); + if (atv) { + atv->set_automation_state (ARDOUR::Play); + } } if (UIConfiguration::instance().get_automation_edit_cancels_auto_hide () && control == session->recently_touched_controllable ()) { @@ -1647,3 +1649,9 @@ AutomationLine::add (std::shared_ptr control, GdkEvent* event session->set_dirty (); } } + +void +AutomationLine::set_atv (AutomationTimeAxisView& a) +{ + atv = &a; +} diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index ef863e1d28..2f9aebee88 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -78,6 +78,9 @@ public: virtual ~AutomationLine (); + + void set_atv (AutomationTimeAxisView&); + virtual Temporal::timepos_t get_origin () const; ArdourCanvas::Rectangle* drag_base() const { return _drag_base; } @@ -271,6 +274,7 @@ private: const ARDOUR::ParameterDescriptor _desc; bool _control_points_inherit_color; bool _sensitive; + AutomationTimeAxisView* atv; friend class AudioRegionGainLine; friend class RegionFxLine; diff --git a/gtk2_ardour/editor_automation_line.cc b/gtk2_ardour/editor_automation_line.cc index a6025c8cd9..e6e92a8a20 100644 --- a/gtk2_ardour/editor_automation_line.cc +++ b/gtk2_ardour/editor_automation_line.cc @@ -34,15 +34,21 @@ using namespace ARDOUR; /** @param converter A TimeConverter whose origin_b is the start time of the AutomationList in session samples. * This will not be deleted by EditorAutomationLine. */ -EditorAutomationLine::EditorAutomationLine (const string& name, - TimeAxisView& tv, - ArdourCanvas::Item& parent, - std::shared_ptr al, - const ParameterDescriptor& desc) +EditorAutomationLine::EditorAutomationLine (const string& name, + TimeAxisView& tv, + ArdourCanvas::Item& parent, + std::shared_ptr al, + const ParameterDescriptor& desc) : AutomationLine (name, tv.editor(), parent, nullptr, al, desc) , trackview (tv) { line->set_data ("trackview", &trackview); + + AutomationTimeAxisView* atv = dynamic_cast (&tv); + + if (atv) { + set_atv (*atv); + } } EditorAutomationLine::~EditorAutomationLine () diff --git a/gtk2_ardour/editor_automation_line.h b/gtk2_ardour/editor_automation_line.h index 4ea5037daa..dc1054140d 100644 --- a/gtk2_ardour/editor_automation_line.h +++ b/gtk2_ardour/editor_automation_line.h @@ -63,11 +63,11 @@ class PublicEditor; class EditorAutomationLine : public AutomationLine { public: - EditorAutomationLine (const std::string& name, - TimeAxisView& tv, - ArdourCanvas::Item& parent, - std::shared_ptr al, - const ARDOUR::ParameterDescriptor& desc); + EditorAutomationLine (const std::string& name, + TimeAxisView& tv, + ArdourCanvas::Item& parent, + std::shared_ptr al, + const ARDOUR::ParameterDescriptor& desc); virtual ~EditorAutomationLine (); diff --git a/gtk2_ardour/midi_automation_line.cc b/gtk2_ardour/midi_automation_line.cc index 5b622a1096..6866111f40 100644 --- a/gtk2_ardour/midi_automation_line.cc +++ b/gtk2_ardour/midi_automation_line.cc @@ -32,12 +32,12 @@ using namespace std; MidiAutomationLine::MidiAutomationLine ( - const std::string& name, - TimeAxisView& tav, - ArdourCanvas::Item& parent, - std::shared_ptr list, - std::shared_ptr region, - Evoral::Parameter parameter) + const std::string& name, + TimeAxisView& tav, + ArdourCanvas::Item& parent, + std::shared_ptr list, + std::shared_ptr region, + Evoral::Parameter parameter) : EditorAutomationLine (name, tav, parent, list, parameter) , _region (region) , _parameter (parameter)