View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0009720 | ardour | features | public | 2024-06-05 14:44 | 2024-08-01 04:38 |
Reporter | mpk | Assigned To | paul | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Platform | GNU | OS | Linux | OS Version | (any) |
Product Version | 8.6 | ||||
Summary | 0009720: Add actions for region_lock and region_unlock | ||||
Description | Definitive actions are particularly useful when dealing with selections of multiple regions. In this case, toggling the locked status is less useful. For example, when editing one might lock a selection of regions so that they are unaffected by ripple actions earlier in the timeline. In a large selection, it might not be noticed that one region was already locked - toggle-region-lock will thus unlock it resulting in pain and frustration. See attached patch. | ||||
Tags | No tags attached. | ||||
|
region-lock.patch (3,279 bytes)
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 52e2b22bb8..bbf24a82a4 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1336,6 +1336,8 @@ private: /* EDITING OPERATIONS */ void reset_point_selection (); + void region_lock (); + void region_unlock (); void toggle_region_lock (); void toggle_opaque_region (); void toggle_record_enable (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 5bdd8105cd..16ad1ab137 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -1871,8 +1871,12 @@ Editor::register_region_actions () /* Move selected regions to their original (`natural') position */ register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "naturalize-region", _("Move to Original Position"), sigc::mem_fun (*this, &Editor::naturalize_region)); + /* Change `locked' status of selected regions */ + register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "region-lock", _("Lock"), sigc::mem_fun(*this, &Editor::region_lock)); + register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "region-unlock", _("Unlock"), sigc::mem_fun(*this, &Editor::region_unlock)); + /* Toggle `locked' status of selected regions */ - register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-lock", _("Lock"), sigc::mem_fun(*this, &Editor::toggle_region_lock)); + register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-lock", _("Lock (toggle)"), sigc::mem_fun(*this, &Editor::toggle_region_lock)); register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-video-lock", _("Lock to Video"), sigc::mem_fun(*this, &Editor::toggle_region_video_lock)); /* Remove sync points from selected regions */ diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index a00cd24aff..b5a228c276 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6731,6 +6731,54 @@ Editor::toggle_gain_envelope_active () } } +void +Editor::region_lock () +{ + if (_ignore_region_action) { + return; + } + + RegionSelection rs = get_regions_from_selection_and_entered (); + + if (!_session || rs.empty()) { + return; + } + + begin_reversible_command (_("region lock")); + + for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { + (*i)->region()->clear_changes (); + (*i)->region()->set_locked (true); + _session->add_command (new StatefulDiffCommand ((*i)->region())); + } + + commit_reversible_command (); +} + +void +Editor::region_unlock () +{ + if (_ignore_region_action) { + return; + } + + RegionSelection rs = get_regions_from_selection_and_entered (); + + if (!_session || rs.empty()) { + return; + } + + begin_reversible_command (_("region unlock")); + + for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) { + (*i)->region()->clear_changes (); + (*i)->region()->set_locked (false); + _session->add_command (new StatefulDiffCommand ((*i)->region())); + } + + commit_reversible_command (); +} + void Editor::toggle_region_lock () { |
|
patch applied, with thanks. Good idea! |