automation text entry only when using kbd

This commit is contained in:
Paul Davis 2025-07-10 23:23:08 -06:00
parent b5dada592d
commit 854e999436
3 changed files with 22 additions and 5 deletions

View file

@ -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,13 +1068,18 @@ AutomationLine::get_inverted_selectables (Selection&, list<Selectable*>& /*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) {
if (&p->line() == this) {
one_of_ours = true;
p->set_selected (true);
}
}
if (points.empty()) {
remove_visibility (SelectedControlPoints);
@ -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<ArdourCanvas::GtkCanvas*> (cp->item().canvas());
Gtk::Window* toplevel = static_cast<Gtk::Window*> (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<AutomationControl> control, GdkEvent* event, timepos_t const & pos, double y, bool with_guard_points)
AutomationLine::add (std::shared_ptr<AutomationControl> 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<AutomationControl> control, GdkEvent* event
XMLNode& before = alist->get_state();
std::list<Selectable*> 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<AutomationControl> control, GdkEvent* event
_editing_context.commit_reversible_command ();
session->set_dirty ();
}
}
void

View file

@ -191,7 +191,7 @@ public:
ARDOUR::ParameterDescriptor const & param() const { return _desc; }
EditingContext& editing_context() const { return _editing_context; }
void add (std::shared_ptr<ARDOUR::AutomationControl>, GdkEvent*, Temporal::timepos_t const &, double y, bool with_guard_points);
void add (std::shared_ptr<ARDOUR::AutomationControl>, 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;

View file

@ -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