From 854e999436dd4080b2793c53bbc265eba2640908 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 10 Jul 2025 23:23:08 -0600 Subject: [PATCH] automation text entry only when using kbd --- gtk2_ardour/automation_line.cc | 22 +++++++++++++++++++--- gtk2_ardour/automation_line.h | 3 ++- gtk2_ardour/editor_actions.cc | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 8fab730a07..52939cb4b5 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -115,6 +115,7 @@ AutomationLine::AutomationLine (const string& name, , _control_points_inherit_color (true) , _sensitive (true) , atv (nullptr) + , entry_required_post_add (false) , automation_entry (nullptr) { group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple(0, 1.5)); @@ -1067,12 +1068,17 @@ AutomationLine::get_inverted_selectables (Selection&, list& /*resul void AutomationLine::set_selected_points (PointSelection const & points) { + bool one_of_ours = false; + for (auto & cp : control_points) { cp->set_selected (false); } for (auto & p : points) { - p->set_selected (true); + if (&p->line() == this) { + one_of_ours = true; + p->set_selected (true); + } } if (points.empty()) { @@ -1083,7 +1089,7 @@ AutomationLine::set_selected_points (PointSelection const & points) set_colors (); - if (points.size() == 1) { + if (one_of_ours && entry_required_post_add && points.size() == 1) { ControlPoint* cp (points.front()); std::stringstream str; str << (*cp->model())->value << ' ' << "Hz"; @@ -1091,6 +1097,7 @@ AutomationLine::set_selected_points (PointSelection const & points) ArdourCanvas::GtkCanvas* cvp = dynamic_cast (cp->item().canvas()); Gtk::Window* toplevel = static_cast (cvp->get_toplevel()); if (!toplevel) { + entry_required_post_add = false; return; } @@ -1113,6 +1120,10 @@ AutomationLine::set_selected_points (PointSelection const & points) automation_entry->move (rwx + wx, rwy + wy); automation_entry->show (); } + + if (one_of_ours) { + entry_required_post_add = false; + } } void @@ -1628,7 +1639,7 @@ AutomationLine::set_offset (timepos_t const & off) } void -AutomationLine::add (std::shared_ptr control, GdkEvent* event, timepos_t const & pos, double y, bool with_guard_points) +AutomationLine::add (std::shared_ptr control, GdkEvent* event, timepos_t const & pos, double y, bool with_guard_points, bool from_kbd) { if (alist->in_write_pass()) { /* do not allow the GUI to add automation events during an @@ -1660,6 +1671,10 @@ AutomationLine::add (std::shared_ptr control, GdkEvent* event XMLNode& before = alist->get_state(); std::list results; + if (from_kbd) { + entry_required_post_add = true; + } + if (alist->editor_add (when, y, with_guard_points)) { if (control->automation_state () == ARDOUR::Off) { @@ -1682,6 +1697,7 @@ AutomationLine::add (std::shared_ptr control, GdkEvent* event _editing_context.commit_reversible_command (); session->set_dirty (); } + } void diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index a4a82bc9d7..99bf699b8f 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -191,7 +191,7 @@ public: ARDOUR::ParameterDescriptor const & param() const { return _desc; } EditingContext& editing_context() const { return _editing_context; } - void add (std::shared_ptr, GdkEvent*, Temporal::timepos_t const &, double y, bool with_guard_points); + void add (std::shared_ptr, GdkEvent*, Temporal::timepos_t const &, double y, bool with_guard_points, bool from_kbd = false); protected: @@ -276,6 +276,7 @@ private: bool _control_points_inherit_color; bool _sensitive; AutomationTimeAxisView* atv; + bool entry_required_post_add; FloatingTextEntry* automation_entry; friend class AudioRegionGainLine; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 98a40bfac2..a4fb56cd3f 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1351,7 +1351,7 @@ Editor::automation_create_point_at_edit_point () event.button.button = 1; event.button.state = 0; - atv->line()->add (atv->control(), &event, where, atv->line()->the_list()->eval (where), false); + atv->line()->add (atv->control(), &event, where, atv->line()->the_list()->eval (where), false, true); } void