From 01bb38d99eac7ec7747524ae5a869a6acc17a559 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 8 Feb 2021 19:45:37 +0100 Subject: [PATCH] Add option to en/disable showing automation-lane on touch --- gtk2_ardour/ardour.menus.in | 1 + gtk2_ardour/editor.cc | 37 ++++++++++++++++++++++++++++++++++ gtk2_ardour/editor.h | 8 ++++++++ gtk2_ardour/editor_actions.cc | 2 ++ gtk2_ardour/public_editor.h | 1 + gtk2_ardour/route_time_axis.cc | 4 +--- 6 files changed, 50 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 4ce22270c8..3486b12bb8 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -276,6 +276,7 @@ + diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 07342e4675..bb7efb7350 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -455,6 +455,7 @@ Editor::Editor () , _region_selection_change_updates_region_list (true) , _cursors (0) , _following_mixer_selection (false) + , _show_touched_automation (false) , _control_point_toggled_on_press (false) , _stepping_axis_view (0) , quantize_dialog (0) @@ -2471,6 +2472,15 @@ Editor::set_state (const XMLNode& node, int version) tact->set_active (yn); } + yn = false; + node.get_property (X_("show-touched-automation"), yn); + { + Glib::RefPtr tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-touched-automation")); + /* do it twice to force the change */ + tact->set_active (!yn); + tact->set_active (yn); + } + XMLNodeList children = node.children (); for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) { selection->set_state (**i, Stateful::current_state_version); @@ -2569,6 +2579,7 @@ Editor::get_state () } node->set_property (X_("show-marker-lines"), _show_marker_lines); + node->set_property (X_("show-touched-automation"), _show_touched_automation); node->add_child_nocopy (selection->get_state ()); node->add_child_nocopy (_regions->get_state ()); @@ -4027,6 +4038,32 @@ Editor::set_stationary_playhead (bool yn) } } +bool +Editor::show_touched_automation () const +{ + if (!contents().is_mapped()) { + return false; + } + return _show_touched_automation; +} + +void +Editor::toggle_show_touched_automation () +{ + RefPtr tact = ActionManager::get_toggle_action (X_("Editor"), X_("show-touched-automation")); + set_show_touched_automation (tact->get_active()); +} + +void +Editor::set_show_touched_automation (bool yn) +{ + if (_show_touched_automation == yn) { + return; + } + _show_touched_automation = yn; + instant_save (); +} + PlaylistSelector& Editor::playlist_selector () const { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index c9c2824efb..2cb0d1e0ce 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -386,6 +386,9 @@ public: /* returns the left-most and right-most time that the gui should allow the user to scroll to */ std::pair session_gui_extents (bool use_extra = true) const; + /* RTAV Automation display option */ + bool show_touched_automation () const; + /* fades */ void toggle_region_fades (int dir); @@ -2309,6 +2312,11 @@ private: void follow_mixer_selection (); bool _following_mixer_selection; + /* RTAV Automation display option */ + void toggle_show_touched_automation (); + void set_show_touched_automation (bool); + bool _show_touched_automation; + int time_fx (ARDOUR::RegionList&, float val, bool pitching); void note_edit_done (int, EditNoteDialog*); void toggle_sound_midi_notes (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 39adddb42e..4d91367bf1 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -446,6 +446,8 @@ Editor::register_actions () ActionManager::register_toggle_action (editor_actions, "toggle-stationary-playhead", _("Stationary Playhead"), (mem_fun(*this, &Editor::toggle_stationary_playhead))); + ActionManager::register_toggle_action (editor_actions, "show-touched-automation", _("Show Automation Lane on Touch"), (mem_fun(*this, &Editor::toggle_show_touched_automation))); + act = reg_sens (editor_actions, "insert-time", _("Insert Time"), (sigc::mem_fun(*this, &Editor::do_insert_time))); ActionManager::track_selection_sensitive_actions.push_back (act); act = ActionManager::register_action (editor_actions, "remove-time", _("Remove Time"), (mem_fun(*this, &Editor::do_remove_time))); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 399cdb7731..0b26383ac5 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -365,6 +365,7 @@ public: virtual void embed_audio_from_video (std::string, samplepos_t n = 0, bool lock_position_to_video = true) = 0; virtual bool track_selection_change_without_scroll () const = 0; + virtual bool show_touched_automation () const = 0; virtual StripableTimeAxisView* get_stripable_time_axis_by_id (const PBD::ID& id) const = 0; diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index b9e1fb9dbf..bb0f0b4e00 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1602,11 +1602,9 @@ RouteTimeAxisView::show_touched_automation (boost::weak_ptr w return; } -#if 0 - if (!_editor.show_touched_automation_lane ()) { + if (!_editor.show_touched_automation ()) { return; } -#endif ProcessorAutomationNode* pan = find_processor_automation_node (ac); if (!pan) {