From e81794d87844501be0eec3c335d6007d4a9d3ef6 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 2 Mar 2021 19:00:23 +0100 Subject: [PATCH] Add preference to keep spilled automation-lanes visible --- gtk2_ardour/automation_region_view.cc | 3 +++ gtk2_ardour/automation_time_axis.cc | 3 +++ gtk2_ardour/editor.cc | 2 +- gtk2_ardour/rc_option_editor.cc | 13 +++++++++++++ gtk2_ardour/route_time_axis.cc | 12 ++++++++---- gtk2_ardour/route_time_axis.h | 4 ++-- gtk2_ardour/ui_config_vars.h | 1 + 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 0851765750..3ba73058d1 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -210,6 +210,9 @@ AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double if (ac->automation_state () == ARDOUR::Off) { ac->set_automation_state (ARDOUR::Play); } + if (UIConfiguration::instance().get_automation_edit_cancels_auto_hide () && ac == view->session()->recently_touched_controllable ()) { + RouteTimeAxisView::signal_ctrl_touched (false); + } view->editor().begin_reversible_command (_("add automation event")); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 8e29b47801..78ff997fdb 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -794,6 +794,9 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, samplepos_t sampl if (_control->automation_state () == ARDOUR::Off) { _control->set_automation_state (ARDOUR::Play); } + if (UIConfiguration::instance().get_automation_edit_cancels_auto_hide () && _control == _session->recently_touched_controllable ()) { + RouteTimeAxisView::signal_ctrl_touched (false); + } XMLNode& after = list->get_state(); _editor.begin_reversible_command (_("add automation event")); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 8a936af53c..f593f4917a 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4066,7 +4066,7 @@ Editor::set_show_touched_automation (bool yn) } _show_touched_automation = yn; if (!yn) { - RouteTimeAxisView::signal_ctrl_touched (); + RouteTimeAxisView::signal_ctrl_touched (true); } instant_save (); } diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 138ff604a0..1de7ba6474 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -3041,6 +3041,19 @@ These settings will only take effect after %1 is restarted.\n\ Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(), _("When enabled new points drawn in any automation lane will be placed on the existing line, regardless of mouse y-axis position.")); + bo = new BoolOption ( + "automation-edit-cancels-auto-hide", + _("Automation edit_cancels_auto_hide"), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_automation_edit_cancels_auto_hide), + sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_automation_edit_cancels_auto_hide) + ); + add_option (_("Editor"), bo); + Gtkmm2ext::UI::instance()->set_tip (bo->tip_widget(), + _("When enabled automatically displayed automation lanes remain visible if events are added to the lane.\n" + "When disabled, spilled automation lanes are unconditionally hidden when a different control is touched.\n" + "This setting only has effect if 'Show Automation Lane on Touch' is used.") + ); + ComboOption* fadeshape = new ComboOption ( "default-fade-shape", _("Default fade shape"), diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 3c0bf77dab..8703573710 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -105,7 +105,7 @@ using namespace Editing; using namespace std; using std::list; -sigc::signal RouteTimeAxisView::signal_ctrl_touched; +sigc::signal RouteTimeAxisView::signal_ctrl_touched; RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas) : RouteUI(sess) @@ -1581,9 +1581,13 @@ RouteTimeAxisView::show_existing_automation (bool apply_to_selection) } void -RouteTimeAxisView::maybe_hide_automation (boost::weak_ptr wctrl) +RouteTimeAxisView::maybe_hide_automation (bool hide, boost::weak_ptr wctrl) { ctrl_autohide_connection.disconnect (); + if (!hide) { + /* disconnect only, leave lane visible */ + return; + } boost::shared_ptr ac = boost::dynamic_pointer_cast (wctrl.lock ()); if (!ac) { return; @@ -1604,7 +1608,7 @@ RouteTimeAxisView::show_touched_automation (boost::weak_ptr w if (!_editor.show_touched_automation ()) { if (ctrl_autohide_connection.connected ()) { - signal_ctrl_touched (); + signal_ctrl_touched (true); } return; } @@ -1615,7 +1619,7 @@ RouteTimeAxisView::show_touched_automation (boost::weak_ptr w } /* hide any lanes */ - signal_ctrl_touched (); + signal_ctrl_touched (true); if (!pan->menu_item->get_active ()) { pan->menu_item->set_active (true); diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index d133198aca..53b63f768c 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -141,7 +141,7 @@ public: void meter_changed (); void effective_gain_display () { gm.effective_gain_display(); } - static sigc::signal signal_ctrl_touched; + static sigc::signal signal_ctrl_touched; std::string state_id() const; @@ -307,7 +307,7 @@ private: void parameter_changed (std::string const & p); void update_track_number_visibility(); void show_touched_automation (boost::weak_ptr); - void maybe_hide_automation (boost::weak_ptr); + void maybe_hide_automation (bool, boost::weak_ptr); void drop_instrument_ref (); void reread_midnam (); diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h index 17feca4dc8..37d1ea6a01 100644 --- a/gtk2_ardour/ui_config_vars.h +++ b/gtk2_ardour/ui_config_vars.h @@ -42,6 +42,7 @@ UI_CONFIG_VARIABLE (bool, draggable_playhead, "draggable-playhead", true) UI_CONFIG_VARIABLE (float, draggable_playhead_speed, "draggable-playhead-speed", 0.5) UI_CONFIG_VARIABLE (float, extra_ui_extents_time, "extra-ui-extents-time", 1.0) UI_CONFIG_VARIABLE (bool, new_automation_points_on_lane, "new-automation-points-on-lane", false) +UI_CONFIG_VARIABLE (bool, automation_edit_cancels_auto_hide, "automation-edit-cancels-auto-hide", false) UI_CONFIG_VARIABLE (std::string, keyboard_layout, "keyboard-layout", "ansi") UI_CONFIG_VARIABLE (std::string, keyboard_layout_name, "keyboard-layout-name", "ansi") UI_CONFIG_VARIABLE (std::string, default_bindings, "default-bindings", "ardour")